seo vanity url

How to configure SEOs without specifying a default one


In Jahia, it is not possible to configure SEOs without having one set as default SEO. The following solution should let you get around this requirement.


An editor can follow these steps to avoid having a default SEO.

- when adding SEOs to a content, add a temporary vanity url and set it as default.

- save and publish the content

- edit the content again and remove the temporary vanity url, save and publish

- at this point, you should not have any SEO set as default.


An alternate solution is to run a script to set j:default as false for vanity url nodes. For example, the following script can be run from jcrConsole to remove default vanity urls for site digitall.

String siteKey = "digitall";
final String queryStatement = "SELECT * FROM [jnt:vanityUrl] where isdescendantnode('/sites/" + siteKey + "') and [j:default]='true'"; iterator = session.getWorkspace().getQueryManager().createQuery(queryStatement, Query.JCR_SQL2).execute().getNodes();
    final JCRNodeWrapper node = (JCRNodeWrapper) iterator.nextNode();
    node.setProperty('j:default', 'false')

The script sets the flag to false in default and publishes the changed node.