You can configure dimensions, dimension values, record properties, and aggregate record properties to display in the misc-path of URLs. You can also specify the order in which dimension and dimension values display. The urlconfig.xml file provides a simple and convenient method for configuring these options.

The SeoNavStateFormatter, SeoERecFormatter, and SeoAggrERecFormatter use StringFormatter objects to format dimension and record property strings that display in URLs.

You can format the strings in the misc-path section of a URL by using string formatters that are predefined in the Assembler API. Formatting may include changing capitalization or applying a regular expression to replace portions of the string.

There are several StringFormatter objects in the Assembler API:

To define StringFormatter objects in the urlconfig.xml file:

  1. Create a bean to invoke a StringFormatter class.

    This example shows the configuration for a RegexStringFormatter that replaces all non-word character sequences with a single "-" character:

            <bean class="com.endeca.soleng.urlformatter.seo.RegexStringFormatter">
              <property name="pattern">
                <value><![CDATA[[\W_&&[^\u00C0-\u00FF]]+]]></value>
              </property>
    
              <property name="replacement">
                <value>-</value>
              </property>
    
              <property name="replaceAll">
                <value>true</value>
              </property>
            </bean>
  2. Optionally, you can build a StringFormatterChain to apply more than one StringFormatter to a string in series.

    The following example shows the defaultStringFormatterChain that is used throughout the sample urlconfig.xml file.

      <bean name="defaultStringFormatterChain"
          class="com.endeca.soleng.urlformatter.seo.StringFormatterChain">
    
        <property name="stringFormatters">
          <list>
            <!--
              ##############################################################
              # replace all non-word character sequences with a single '-'
              #
            -->
            <bean class="com.endeca.soleng.urlformatter.seo.RegexStringFormatter">
              <property name="pattern">
                <value><![CDATA[[\W_&&[^\u00C0-\u00FF]]+]]></value>
              </property>
    
              <property name="replacement">
                <value>-</value>
              </property>
    
              <property name="replaceAll">
                <value>true</value>
              </property>
            </bean>
    
            <!--
              ##############################################################
              # trim leading and trailing '-' characters (if any)
              #
            -->
            <bean class="com.endeca.soleng.urlformatter.seo.RegexStringFormatter">
              <property name="pattern">
                <value><![CDATA[^-?([\w\u00C0-\u00FF][\w-\u00C0-\u00FF]*[\w\u00C0-\u00FF])-?$]]></value>
              </property>
    
              <property name="replacement">
                <value>$1</value>
              </property>
    
              <property name="replaceAll">
                <value>false</value>
              </property>
            </bean>
    
          </list>
        </property>
      </bean>

Using URL optimization, you can include dimension and dimension value names in the misc-path of URLs. You can also choose to canonicalize these dimension and dimension value names in order to avoid duplicate content and to increase your natural search rankings.

You must create a URL configuration file before completing this procedure.

To optimize URLs for navigation pages:

  1. Open your URL configuration file.

  2. Create a navStateFormatter bean to invoke the com.endeca.soleng.urlformatter.seo.SeoNavStateFormatter:

    For example:

      <bean id="navStateFormatter" class="com.endeca.soleng.urlformatter.seo.SeoNavStateFormatter">
      </bean>
  3. Add a navStateFormatter property to your top-level seoUrlFormatter bean.

    For example:

      <bean id="seoUrlFormatter" class="com.endeca.soleng.urlformatter.seo.SeoUrlFormatter">
    
    <!-- additional elements deleted from this example --!>
    
        <property name="navStateFormatter">
          <ref bean="navStateFormatter"/>
        </property>
    
      </bean>
  4. Add a useDimensionNameAsKey property on the navStateFormatter.

    For example:

      <bean id="navStateFormatter" class="com.endeca.soleng.urlformatter.seo.SeoNavStateFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
      </bean>

    Setting the useDimensionNameAsKey to false creates a key on the dimension ID numbers.

  5. Add a dimLocationFormatters property and list each dimLocationFormatter bean you plan to define.

    For example:

      <bean id="navStateFormatter" class="com.endeca.soleng.urlformatter.seo.SeoNavStateFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="dimLocationFormatters">
          <list>
            <ref bean="wineTypeFormatter"/>
            <ref bean="regionFormatter"/>
            <ref bean="wineryFormatter"/>
            <ref bean="flavorsFormatter"/>
          </list>
        </property>
    
      </bean>
  6. Create a dimLocationFormatter for each of the dimensions in the dimLocationFormatters list.

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
      </bean>
  7. Add the following properties to each dimLocationFormatter:

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
    
        <property name="key">
          <value>Region</value>
        </property>
    
        <property name="appendRoot">
          <value>false</value>
        </property>
    
        <property name="appendAncestors">
          <value>false</value>
        </property>
    
        <property name="appendDescriptor">
          <value>true</value>
        </property>
    
        <property name="separator">
          <value>-</value>
        </property>
    
        <property name="rootStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
        <property name="dimValStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  8. Create a navStateCanonicalizer bean to invoke the com.endeca.soleng.urlformatter.seo.SeoNavStateCanonicalizer class.

    For example:

      <bean name="navStateCanonicalizer" class="com.endeca.soleng.urlformatter.seo.SeoNavStateCanonicalizer">
      </bean>

  9. Add a navStateCanonicalizer property to your top-level seoUrlFormatter bean.

    For example:

      <bean id="seoUrlFormatter" class="com.endeca.soleng.urlformatter.seo.SeoUrlFormatter">
    
    <!-- additional elements deleted from this example --!>
    
        <property name="navStateCanonicalizer">
          <ref bean="navStateCanonicalizer"/>
        </property>
    
      </bean>
  10. Configure the navStateCanonicalizer.

    For example, the following configuration creates URLs sorted by dimension ID in descending order:

      <bean name="navStateCanonicalizer" class="com.endeca.soleng.urlformatter.seo.SeoNavStateCanonicalizer">
    
        <property name="sortByName">
          <value>false</value>
        </property>
    
        <property name="sortByDimension">
          <value>true</value>
        </property>
    
        <property name="ascending">
          <value>false</value>
        </property>
    
      </bean>
  11. Save and close the file.

You can customize the canonicalization of URLs for navigation pages by choosing a sort method, for example by dimension name or dimension ID, and then a sort direction.

The following example configurations use the dimensions:

and the dimension values:

Sort by

Configuration

Example base URL (sort direction ascending)

Dimension name, case sensitive

<property name="sortByName">
  <value>true</value>
</property>

<property name="sortByDimension">
  <value>true</value>
</property>

<property name="ignoreCase">
  <value>false</value>
</property>

http://localhost/urlformatter_jspref/controller/Wine-red/region-Napa/

Dimension name, case insensitive

<property name="sortByName">
  <value>true</value>
</property>

<property name="sortByDimension">
  <value>true</value>
</property>

<property name="ignoreCase">
  <value>true</value>
</property>

http://localhost/urlformatter_jspref/controller/region-Napa/Wine-red/

Dimension ID

<property name="sortByName">
  <value>false</value>
</property>

<property name="sortByDimension">
  <value>true</value>
</property>

http://localhost/urlformatter_jspref/controller/region-Napa/Wine-red/

Dimension value name, case sensitive

<property name="sortByName">
  <value>true</value>
</property>

<property name="sortByDimension">
  <value>false</value>
</property>

<property name="ignoreCase">
  <value>false</value>
</property>

http://localhost/urlformatter_jspref/controller/region-Napa/Wine-red/

Dimension value name, case insensitive

<property name="sortByName">
  <value>true</value>
</property>

<property name="sortByDimension">
  <value>false</value>
</property>

<property name="ignoreCase">
  <value>true</value>
</property>

http://localhost/urlformatter_jspref/controller/region-Napa/Wine-red/

Dimension value ID

<property name="sortByName">
  <value>false</value>
</property>

<property name="sortByDimension">
  <value>false</value>
</property>

http://localhost/urlformatter_jspref/controller/Wine-red/region-Napa/

Using the URL optimization classes, you can include dimension names, dimension value names, and record properties in the misc-path of URLs for record detail pages.

You must create a URL configuration file before completing this procedure.

To optimize URLs for record detail pages:

  1. Open your URL configuration file.

  2. Create an erecFormatter bean to invoke the com.endeca.soleng.urlformatter.seo.SeoERecFormatter:

    For example:

      <bean id="erecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoERecFormatter">
      </bean>
  3. Add an ERecFormatter property to your top-level seoUrlFormatter bean.

    For example:

      <bean id="seoUrlFormatter" class="com.endeca.soleng.urlformatter.seo.SeoUrlFormatter">
    
    <!-- additional elements deleted from this example --!>
    
        <property name="ERecFormatter">
          <ref bean="erecFormatter"/>
        </property>
    
      </bean>
  4. Add a useDimensionNameAsKey property on the erecFormatter.

    For example:

      <bean id="erecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
      </bean>

    Setting useDimensionNameAsKey to false creates a key on the dimension ID numbers.

  5. Add a propertyKeys property to include record properties in the URLs of record details pages.

    For example:

      <bean id="erecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
    
      </bean>
  6. Add a propertyFormatter property to format record properties included in the URLs of record details pages.

    For example:

      <bean id="erecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
    
        <property name="propertyFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  7. Add a dimLocationFormatters property and list each dimLocationFormatter bean you plan to define.

    For example:

      <bean id="erecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="dimLocationFormatters">
          <list>
            <ref bean="regionFormatter"/>
            <ref bean="wineryFormatter"/>
            <ref bean="wineTypeFormatter"/>
            <ref bean="vintageFormatter"/>
          </list>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
    
        <property name="propertyFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  8. Create a dimLocationFormatter for each of the dimensions in the dimLocationFormatters list.

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
      </bean>
  9. Add the following properties to each dimLocationFormatter:

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
    
        <property name="key">
          <value>Region</value>
        </property>
    
        <property name="appendRoot">
          <value>false</value>
        </property>
    
        <property name="appendAncestors">
          <value>false</value>
        </property>
    
        <property name="appendDescriptor">
          <value>true</value>
        </property>
    
        <property name="separator">
          <value>-</value>
        </property>
    
        <property name="rootStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
        <property name="dimValStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  10. Save and close the file.

Using the URL optimization classes, you can include dimension names, dimension value names, and record properties in the misc-path of URLs for aggregate record detail pages. These are configured separately from the optimizations for navigation pages.

You must create a URL configuration file before completing this procedure.

To optimize URLs for aggregate record detail pages:

  1. Open your URL configuration file.

  2. Create an aggrERecFormatter bean to invoke the com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter class:

    For example:

      <bean id="aggrERecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter">
      </bean>
  3. Add an aggrERecFormatter property to your top-level seoUrlFormatter bean.

    For example:

      <bean id="seoUrlFormatter" class="com.endeca.soleng.urlformatter.seo.SeoUrlFormatter">
    
    <!-- additional elements deleted from this example --!>
    
        <property name="aggrERecFormatter">
          <ref bean="aggrERecFormatter"/>
        </property>
    
      </bean>
  4. Add a useDimensionNameAsKey property on the aggrERecFormatter.

    For example:

      <bean id="aggrERecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
      </bean>

    Setting the useDimensionNameAsKey to false creates a key on the dimension ID numbers.

  5. Add a propertyKeys property to include record properties in the URLs of record details pages.

    For example:

      <bean id="aggrERecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
    
      </bean>
  6. Add a propertyFormatter property to format record properties included in the URLs of record details pages.

    For example:

      <bean id="aggrERecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
        <!-- use default string formatter chain -->
    
        <property name="propertyFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  7. Add a dimLocationFormatters property and list each dimLocationFormatter bean you plan to define.

    For example:

      <bean id="aggrERecFormatter" class="com.endeca.soleng.urlformatter.seo.SeoAggrERecFormatter">
    
        <property name="useDimensionNameAsKey">
          <value>true</value>
        </property>
    
        <property name="dimLocationFormatters">
          <list>
            <ref bean="regionFormatter"/>
            <ref bean="wineryFormatter"/>
          </list>
        </property>
    
        <property name="propertyKeys">
          <list>
            <value>P_Name</value>
          </list>
        </property>
    
        <property name="propertyFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  8. Create a dimLocationFormatter for each of the dimensions in the dimLocationFormatters list.

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
      </bean>
  9. Add the following properties to each dimLocationFormatter:

    For example:

      <bean id="regionFormatter"
          class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">
    
        <property name="key">
          <value>Region</value>
        </property>
    
        <property name="appendRoot">
          <value>false</value>
        </property>
    
        <property name="appendAncestors">
          <value>false</value>
        </property>
    
        <property name="appendDescriptor">
          <value>true</value>
        </property>
    
        <property name="separator">
          <value>-</value>
        </property>
    
        <property name="rootStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
        <property name="dimValStringFormatter">
          <ref bean="defaultStringFormatterChain"/>
        </property>
    
      </bean>
  10. Save and close the file.


Copyright © Legal Notices