Support Article - Example of How to Setup and Access PWA Sitemaps

1 Introduction

This article describes how to set up and access the PWA sitemaps generated by Intershop Commerce Management, which are located in the $IS_SHARE/sites/... directory.

1.1 References

2 Apply PWA Changes

2.1 Update the PWA Project

Apply all changes from the PWA Pull Request #918 by cherry picking or by updating the PWA to 1.4+ to be able to access generated PWA sitemaps from the ICM server via REST.

Fix: make ICM sitemap files available via nginx #918

https://github.com/intershop/intershop-pwa/pull/918

2.2 Add Environment Variable 'ICM_BASE_URL' to NGINX Container

Making the sitemap files available requires NGINX proxy functionality. The environment variable 'ICM_BASE_URL' has to be specified for the NGINX container and points to the ICM backend installation, e.g. 'https://jxdemoserver6.intershop.de'.

intershop-pwa/docker-compose.yml
nginx:
  ...
  environment:
+   ICM_BASE_URL: 'https://jxdemoserver6.intershop.de'
    ...

Please note that this approach does not consider the setup of multiple ICM environments. For this, further adjustments have to be made to the PWA project. For details, please refer to Multi Site Configurations in the PWA documentation at GitHub. 

3 Apply ICM Adjustments

3.1 Configure Domain Splitting

The ICM server that generates the PWA sitemaps requires an additional domain splitting configuration for the PWA host to ensure that the sitemap links are generated correctly:

$IS_SHARE/system/config/cluster/domainsplittings.xml
+ <domainsplitting name="main PWA host for en_US and USD"> 
+   <hosts> 
+     //Specify the PWA Host 
+     <host>jxdemoserver3.intershop.de</host> 
+   </hosts> 
+   //For Multi-Site (e.g. inSPIRED-inTRONICS-Site and inSPIRED-inTRONICS_Business-Site), define a domainsplitting configuration for each site. 
+   <site>inSPIRED-inTRONICS-Site</site> 
+   <shortpathpattern>/${locale:(de|en)}${path}</shortpathpattern> 
+   <server-group>WFS</server-group> 
+   <currency>USD</currency> 
+   <appurlid>rest</appurlid> 
+   <replacements> 
+     <replacement type="locale"> 
+       <compact>de</compact> 
+       <expand>de_DE</expand> 
+     </replacement> 
+     <replacement type="locale"> 
+       <compact>en</compact> 
+       <expand>en_US</expand> 
+     </replacement> 
+   </replacements>
+ </domainsplitting>

If the ICM was opened with the server group BOS (see URL: https://jxdemoserver6.intershop.de/INTERSHOP/web/BOS/...), use the <server-group> tag BOS (<server-group>BOS</server-group>) in the domain splitting configuration.

Make sure that the NGINX multi site configuration for the locale (/en, /us etc.) matches the one from domainsplittings.xml (<compact>en</compact>, <compact>us</compact> etc.).

intershop-pwa/nginx/docker-compose.yml
nginx:
  ...
  environment:
    ...
    MULTI_CHANNEL: | 
      .+:
        - baseHref: /en
          channel: inSPIRED-inTRONICS-Site
          lang: en_US
$IS_SHARE/system/config/cluster/domainsplittings.xml
<domainsplitting name="main PWA host for en_US and USD"> 
  ...
  <replacements> 
    ...
    <replacement type="locale"> 
      <compact>en</compact> 
      <expand>en_US</expand> 
    </replacement> 
  </replacements>
</domainsplitting>

If no URL parameter is specified for the locale, the configuration could look like this:

$IS_SHARE/system/config/cluster/domainsplittings.xml
+ <domainsplitting name="main PWA host for en_US and USD"> 
+   <hosts> 
+     <host>jxdemoserver3.intershop.de</host> 
+   </hosts> 
+   <site>inSPIRED-inTRONICS-Site</site> 
+   <shortpathpattern>${path}</shortpathpattern> 
+   <server-group>WFS</server-group> 
+   <currency>EUR</currency> 
+   <appurlid>rest</appurlid> 
+ </domainsplitting>
intershop-pwa/nginx/docker-compose.yml
nginx:
  ...
  environment:
    ...
    MULTI_CHANNEL: | 
      .*jxdemoserver3.intershop.de
        channel: inSPIRED-inTRONICS-Site
        lang: de_DE

3.2 Enable REST Application-Specific Webserver Configuration

To specify application-specific or domain-specific properties, create a new .properties file (e.g. url.properties) in the corresponding $IS_SHARE/system/config folder and specify the WebServerURL and WebServerSecureURL of the PWA host(s) in it:

$IS_SHARE/system/config/apps/intershop.REST/url.properties
intershop.WebServerURL=http://jxdemoserver3.intershop.de:80
intershop.WebServerSecureURL=https://jxdemoserver3.intershop.de:443

The same can be applied on a domain-specific basis.

$IS_SHARE/system/config/domains/inSPIRED-inTRONICS-Site/url.properties
intershop.WebServerURL=http://jxdemoserver3.intershop.de:80
intershop.WebServerSecureURL=https://jxdemoserver3.intershop.de:443

Domain-specific WebServerURLs can only be used for a single application approach (1 channel > 1 application).

3.3 Restart the Application Server

The domain splitting and Web Server URL configurations require a restart of the application server.

This step can be skipped by enabling the following CheckSource properties:

$IS_SHARE/system/config/cluster/appserver.properties
intershop.urlrewrite.CheckSource=true
intershop.configuration.CheckSource=true

3.4 Enable URL Rewriting for the inSPIRED-inTRONICS-Site

To enable URL rewriting for the inSPIRED-inTRONICS-Site: 

  1. Open Intershop System Management
  2. Go to Site Management | <Site> | General.
  3. Check URL Rewriting.
  4. Click Apply.

3.5 Enter External Base URL for PWA Application in ICM

To set the External Base URL for the PWA application:

  1. Open Intershop Commerce Management.
  2. Switch to the channel.
  3. Go to Applications | <PWA-Application> | General.
  4. Enter the External Base URL.
  5. Click Apply.

3.6 Generate PWA Sitemap Files

To generate PWA sitemap files: 

  1. Go to Catalogs | Product Data Feeds.
  2. Click New.
  3. Enter a name and an ID.

    Note

    The name of the sitemap must start with: sitemap_

  4. Click Apply.
  5. Switch to the Target tab.
  6. Provide File Name, e.g. sitemap_pwa.xml and set Application to Progressive Web App.
  7. Make additional configurations if required.
  8. Click Apply.

3.7 Copy All Generated Sitemap Files (Workaround for Specific ICM Versions)

This is a workaround for all versions under ICM 7.10.26.20-LTS, 7.10.32.11-LTS and 7.10.37.0, because the location of the generated sitemaps has changed with these versions.

To make the sitemaps available via REST, up to ICM 7.10.26.19-LTS, 7.10.32.10-LTS and 7.10.36.0 it is necessary to copy the generated sitemaps from:

/eserver1/share/sites/inSPIRED-inTRONICS-Site/units/inSPIRED-inTRONICS/syndication/sitemaps/sitemap_pwa

to:

/eserver1/share/sites/inSPIRED-inTRONICS-Site/1/static/en_US/sitemaps/pwa/

Once the sitemaps can be retrieved via a REST request to the ICM server, the PWA is able to get the sitemaps.

GET https://jxdemoserver6.intershop.de/INTERSHOP/static/WFS/inSPIRED-inTRONICS-Site/rest/inSPIRED-inTRONICS/en_US/sitemaps/pwa/sitemap_pwa.xml

3.8 Access Sitemap Files via PWA

GET https://jxdemoserver3.intershop.de/en/sitemap_pwa.xml

GET https://jxdemoserver3.intershop.de/en/sitemap_pwa-product-0.xml.gz

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Tickets