I have a patch ready that I will post momentarily which expands this module to support any path or URI via direct matching or regular expression matching, and also supports the D8 configuration system so it has a config page and doesn't require editing of the module file.
With this patch, you can go to Configuration > Search and Metadata > Noindex and enter a list of paths and a list of request URIs, optionally with regular expressions using # as a delimiter.
For example, to reproduce the functionality this module had before by using a list of node IDs, you'd configure the paths like this:
/node/123
/node/200
/node/4567
Or if you were so inclined you could apply it to all nodes with a regular expression:
#^/node/[0-9]+#
Or using the Request URI Patterns field, you can search for part of the incoming request URI, including such things as any query string that is in the request.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | INTERDIFF.txt | 2.63 KB | phjou |
| #5 | noindex-configuration_support-3002284-5.patch | 25.74 KB | phjou |
| #2 | noindex-configuration_support-3002284-2.patch | 24.85 KB | replicaobscura |
Issue fork noindex-3002284
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
replicaobscuraAttached is the mentioned patch. It seems to be working for my use case and in my testing of various options so far.
Comment #3
replicaobscuraComment #4
chapf commentedThank you. Will look into it.
Comment #5
phjouIndeed, that patch is really needed. The module is usefull but modify a file of the module to do what you want is not a good practice. Having the config is much better.
The patch works great! I just have done some improvements by fixing coding style and adding the missing schema of the configuration.
Comment #6
replicaobscuraJust a note that we updated to patch 5 and have been using it for a while now successfully!
Comment #8
adamzimmermann commentedI'm working on a new 2.x release that will include D9 support and this functionality.
I'm going to do some final testing and tweaking and get this committed soon.
Thank you for the contribution and testing.
Comment #10
adamzimmermann commentedI altered the patch to use
\Drupal::service('current_route_match')->getRouteName();instead of\Drupal::service('path.current')->getPath();for one of the checks as that seemed valuable to me. The path check seemed redundant since we already had\Drupal::request()->getRequestUri();. In my brief testing, they were returning the same thing.The entire patch seems to function as intended and work with D9 also.
Perhaps that should be a follow-up issue though. I would be happy to add it back if an issue is filed that explains it!
Comment #12
adamzimmermann commented