Index only content checked as Domain source

Created on 18 July 2024, 5 months ago

Problem/Motivation

It is actually possible to check an option called "Use node source instead of node access as filter" but it looks like no filter are effective in the code. The result in the sitemap.xml still display contents from other domain source.

Steps to reproduce

  1. Install the module "domain_simple_sitemap" 3.0.0-beta1
  2. Go to /admin/config/domain/domain_simple_sitemap/config and check the option mentionned in the problem/motivation
  3. After having generate your variant and defining you different sitemap for each domain, clic on generate on this page admin/config/search/simplesitemap and consult the /sitemap.xml you will see links regarding differents domain and not only the one in your URL

Proposed resolution

If you know that this feature works correctly, please provide the how to make it works?
Otherwise I suggest to add a condition in docroot/modules/contrib/domain_simple_sitemap/src/Plugin/simple_sitemap/UrlGenerator/DomainEntityUrlGenerator.php:81 that will check for the config value of the checked option.

Here is the suggesstion of code to include:

$config = \Drupal::config('domain_simple_sitemap.settings');
\Drupal::logger('debug')->debug($config->get('domain_simple_sitemap_filter'));
if ($config->get('domain_simple_sitemap_filter')) {
  $query->condition(DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD, $sitemap_domain_id);
}

Remaining tasks

Create a patch.

User interface changes

None, the option checkbox already exist on the following admin page /admin/config/domain/domain_simple_sitemap/config

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇨🇭Switzerland redzeuf Geneva

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

Comments & Activities

Production build 0.71.5 2024