Written by The Jahia Team
 
Developers
Sysadmins
   Estimated reading time:

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.

Answer

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'";
org.jahia.services.content.MultipleNodeIterator iterator = session.getWorkspace().getQueryManager().createQuery(queryStatement, Query.JCR_SQL2).execute().getNodes();
while(iterator.hasNext()){
    final JCRNodeWrapper node = (JCRNodeWrapper) iterator.nextNode();
    node.setProperty('j:default', 'false')
    session.save()
    ServicesRegistry.getInstance().getJCRPublicationService().publishByMainId(node.getIdentifier())
}

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

Related links