Skip to content

Adds sitemap enabled to Feed Me#1694

Open
ishetnogferre wants to merge 2 commits intonystudio107:develop-v5from
ishetnogferre:patch-1
Open

Adds sitemap enabled to Feed Me#1694
ishetnogferre wants to merge 2 commits intonystudio107:develop-v5from
ishetnogferre:patch-1

Conversation

@ishetnogferre
Copy link
Copy Markdown

Description

This PR adds the field for "Sitemap Enabled" in feedme.

Caveat

This PR only adds the field, but it doesn't allow it yet to be imported. That still gets blocked by the "override" option.
For the robots field, it just worked out of the box, so I compared the processing of those two and found this to be the difference:

In Sitemap.php in processing the metaSiteMapVars the inherited are removed.

$attributes = $fieldMetaBundle->metaSitemapVars->getAttributes();
$inherited = array_keys(ArrayHelper::remove($attributes, 'inherited', []));
$attributes = array_intersect_key($attributes, array_flip((array)$seoSettingsField->sitemapEnabledFields));
$attributes = array_filter($attributes, [ArrayHelper::class, 'preserveBools']);
foreach ($inherited as $inheritedAttribute) {
    unset($attributes[$inheritedAttribute]);
}
$metaBundle->metaSitemapVars->setAttributes($attributes, false);

But in later in Sitemap.php in processing the metaGlobalVars they aren't.

$attributes = $fieldMetaBundle->metaGlobalVars->getAttributes();
$attributes = array_filter(
    $attributes,
    [ArrayHelper::class, 'preserveBools']
);
$metaBundle->metaGlobalVars->setAttributes($attributes, false);

Solution

The solution is more a business decision on the plugin part where to solve this: in the processing part or in feed-me.
Also I couldn't yet estimate the impact on our code so for a quick-fix, I added the Override field as well and that works.

		{
			label: 'Override Sitemap Enabled',
			handle: 'override-sitemapUrls',
			default: {
				type: 'select',
				options: [
					{ label: 'Don\'t import'|t('feed-me'), value: '' },
					{ label: 'Override (use imported value)', value: '1' },
					{ label: 'Inherit (ignore imported value)', value: '0' },
				],
			}
		},

Related issues

A request for this feature already existed in: #1070

@khalwat
Copy link
Copy Markdown
Collaborator

khalwat commented Jan 22, 2026

Thanks for the PR, I'll have a look at the issue you raised as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants