Exclude a single node programmatically for 8.x

Created on 19 September 2023, over 1 year ago
Updated 25 October 2023, about 1 year ago

I want a created node to be excluded programmatically in the XML sitemap for the 8.x version.

So this does not work anymore: https://www.drupal.org/project/xmlsitemap/issues/2355451 β†’

$node = Node::create([
    'type' => 'mytype',
    'title' => 'test',
    'uid' => 1
]);

$node->save();

Maybe it's relevant, I made also a menu link for this node:

$menulink = MenuLinkContent::create([
    'title' => $node->getTitle(),
    'link' => [
      'uri' => "entity:node/".$node->id(),
    ],
    'menu_name' => 'main',
    'weight' => 10,
])->save();

How now to exclude the $node or the $menulink?

πŸ’¬ Support request
Status

Active

Version

1.5

Component

Documentation

Created by

πŸ‡©πŸ‡ͺGermany thomaswalther Rhein-Main Area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024