SEO module

  Written by The Jahia Team
 
Developers
  seo
   Estimated reading time:
7.0 7.1 7.2

SEO

Overview

The SEO module is aimed to provide human readable and search engine-friendly URL mappings for content items and automate process of their creation.

It is mainly resposible for managing vanity urls. The module in particular adds the SEO tab in the edit engines, where authors can add multiple URLs on a page or a content item.

Managing URL mappings in UI

Brief overview of the URL mapping management UI for creating, modifying, removing and activating / deactivating URL mappings for content items.

Managing URL mappings using rules

Short summary of business rules, provided for automating URL mapping management.

URL mapping UI

URL mappings can be assigned to content nodes in the Content Edit Engine (SEO tab) on a per-language basis. In this case, it is possible to access same node via different URLs, depending on the current browsing language.

url-mapping-ui.png

Each mapping can be activated or deactivated and one of them can be set as the default one (per language).

Using the language switcher in the Edit Engine one can assign URL mappings for other languages.

URL mapping rules

The SEO module provides rule consequences (right-hand-side part of a rule) to manipulate URL mappings for content objects. The following example, included into Jahia News module, shows the usage of these consequences for automatic generation of URL mappings for news items based on their title.

package org.jahia.modules.seo.rules

//list any import classes here.
import org.jahia.services.content.rules.*
import org.jahia.services.content.JCRContentUtils
import org.slf4j.Logger

expander rules.dsl

//declare any global variables here
global User user
global Service service
global Logger logger
global SeoService seoService
global JCRContentUtils jcrUtils

rule "Add generated URL mapping for news item"
    when
        A property jcr:title has been set on a node
        The node has a parent
            - the parent has the type jnt:news
    then
        Remove URL mappings for node parent and language node.getProperty("jcr:language").getStringValue()
        Add URL mapping "/news/" + jcrUtils.generateNodeName(propertyValueAsString, 70) for node parent and language node.getProperty("jcr:language").getStringValue()
end

The Remove URL mappings for node... action deletes current URL mappings for the language, where as the second action - Add URL mapping... assigns a new mapping, generating it from the title value (propertyValueAsString in the rule above).