I think I missing something but can’t figure out what it is and hope someone can help out.
Using the Demo theme in OC4 for a website with multisite (2 languages).
I’ve 2 things that occurs with the sitemap.
-
The alternative links output show
Default
instead of the right page URL:
<xhtml:link rel=“alternative” hreflang=“en” href=“https://domain.ext/en/default”/> -
When I’m switching these on, I’m getting an error:
Include nested items.
Nested items could be generated dynamically by supported page references.
Replace this item with its generated children.
Use this checkbox to push generated menu items to the same level with this item. This item itself will be hidden.
Getting this error in my log:
ErrorException: foreach() argument must be of type array|object, null given in /var/www/vhosts/domain.ext/httpdocs/modules/tailor/classes/blueprintindexer/PageManagerRegistry.php:193
{#- Look for a specific blueprint code/slug -#}
{% if sitemap is empty %}
{% do abort(500, "A menu definition with code 'sitemap' was not found. Please create this menu in the Admin Panel using the Content → Menus page.") %}
{% endif %}
{#- Function to render a sitemap item, including children -#}
{% macro render_sitemap_item(item, reference, isRoot) %}
{% import _self as nav %}
{% set hideRootItem = isRoot and item.replace %}
{% if reference.url and not hideRootItem %}
<url>
<loc>{{ reference.url }}</loc>
<lastmod>{{ reference.mtime|date('c') }}</lastmod>
<changefreq>{{ item.changefreq }}</changefreq>
<priority>{{ item.priority }}</priority>
{#- Multisite implementation -#}
{% if reference.sites %}
{% for site in reference.sites %}
<xhtml:link rel="alternative" hreflang="{{ site.locale }}" href="{{ site.url }}" />
{% endfor %}
{% endif %}
</url>
{% endif %}
{#- Render child items -#}
{% if reference.items %}
{% for child in reference.items %}
{{ nav.render_sitemap_item(item, child) }}
{% endfor %}
{% endif %}
{% endmacro %}
{% import _self as nav %}
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="https://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
>
{% for item in sitemap.sitemap_items %}
{{ nav.render_sitemap_item(
item,
link(item.reference, { nesting: item.nesting, sites: true }),
true
) }}
{% endfor %}
</urlset>
TAILOR:
uuid: 85e471d2-09b9-4f3d-a63b-1ae9d92d2879
handle: Site\Menus
type: entry
name: Menu
multisite: true
drafts: false
pagefinder: false
customMessages:
buttonCreate: New Menu
navigation:
label: Menus
icon: icon-sitemap
order: 205
parent: Content\Page
columns:
title:
label: Title
entry_type_name:
label: Menu Type
invisible: false
slug:
label: Code
invisible: false
fields:
slug:
label: Code
validation:
- required
groups:
regular_menu:
name: Regular Menu
fields:
items:
label: Menu Items
type: nesteditems
span: adaptive
maxDepth: 0
customMessages:
buttonCreate: Add Item
titleCreateForm: Create Item
titleUpdateForm: Edit Item
form:
fields:
title:
label: Title
tab: Reference
default: New Menu Item
span: full
type: text
autoFocus: true
validation:
- required
reference:
label: Reference
type: pagefinder
tab: Reference
tabs:
fields:
_menu_item:
type: mixin
source: Site\Menus\MenuItem
sitemap_menu:
name: Sitemap Menu
fields:
sitemap_items:
label: Sitemap Items
type: nesteditems
span: adaptive
maxDepth: 1
customMessages:
buttonCreate: Add Sitemap Item
titleCreateForm: Create Sitemap Item
titleUpdateForm: Edit Sitemap Item
form:
fields:
title:
label: Title
tab: Reference
default: New Menu Item
span: full
type: text
autoFocus: true
validation:
- required
reference:
label: Reference
type: pagefinder
tab: Reference
tabs:
fields:
_menu_item:
type: mixin
source: Site\Menus\SitemapItem