Configuring Hreflang Meta Data
Hreflang tags are HTML attributes used to identify the language and geographic region targeted by alternative versions of a page. In some cases, these attributes can help search engines serve the correct version of a page to users and contribute to SEO. By default, Liferay DXP populates page hreflang meta data with all available languages in the site.
Beginning with Liferay 7.4+, you can configure this behavior to generate hreflang meta data only for languages with translated content in a page. This can be configured at both the instance and site levels.
When hreflangs are limited in this way, Liferay’s behavior can vary depending on page type:
-
Widget Pages: Languages used to translate a widget page’s name are added to the hreflang tags.
-
Content Pages/Display Page Templates: Languages used to translate a page fragment are added to the hreflang tags.
Configuring Hreflang Behavior at the Instance Level
-
Open the Global Menu (), click the Control Panel tab, and go to Instance Settings → Pages → SEO (Virtual Instance Scope).
-
Check/Uncheck Enable Only Translated Hreflangs.
-
Click Save.
When enabled, hreflang metadata is only generated for languages with translated content in a page. When disabled, page hreflang tags are populated with all available languages in a site.
Configuring Hreflang Behavior for All Sites in an Instance
-
Open the Global Menu (), click the Control Panel tab, and go to Instance Settings → Pages → SEO (Site Scope).
-
Check/Uncheck Enable Only Translated Hreflangs.
-
Click Save.
When enabled, hreflang meta data is only generated for languages with translated content in a Page. When disabled, page hreflang tags are populated with all available languages in a site.
By default, site scope instance settings are applied to all instance sites. However, individual site configurations override configurations in the Global Menu. To restore the default behavior and synchronize changes between both menus, you must restore the individual site’s settings to default.
Configuring Hreflang Behavior for an Individual Site
-
Navigate to the desired Site.
-
Open the Site Menu (), expand Configuration, and go to Site Setting → Pages → SEO.
-
Check/Uncheck Enable Only Translated Hreflangs.
This configuration only affects pages in the current site.
-
Click Save.
When enabled, hreflang meta data is only generated for languages with translated content in a page. This configuration affects all pages in the current site and overrides the instance configurations settings.
By default, individual site settings are inherited from site scope instance settings. However, individual site configurations override this behavior. To restore the default behavior and synchronize changes between both menus, you must restore the individual site’s settings to default.