Needs review
Project:
RobotsTxt
Version:
7.x-1.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Jan 2019 at 13:05 UTC
Updated:
21 Apr 2021 at 20:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tbsiqueiraComment #3
tbsiqueiraProposing patch to fix the issue, the fix is based on the already proposed patch at the related issue on this bug description.
Implement robotstxt_url_outbound_alter and only alter prefix if we are under /robots.txt path
Comment #4
tbsiqueiraProposing an even simples solution.
Comment #5
Anonymous (not verified) commented#4 works for me.
Another issue:
When xmlsitemap is used only the system sitemap in the original/system language is added in the last line of robots.txt.
Eg, I have a multisite EN (1st language) and NL, "Sitemap: https://www.domain/en/sitemap.xml" is added.
I am missing my second language sitemap: "Sitemap: https://www.domain/nl/sitemap.xml"
Is it possible to add all the used languages as sitemap link?
Comment #6
Anonymous (not verified) commentedMaybe the robots.txt url's with language prefix should not exist (or hidden)?
Only the robots.txt without language prefix is used.
Comment #7
ccjjmartin commentedComment #8
alex.bukach commentedThanks for the patch @tbsiqueira! Generally it works for me, however when I am adding more links via
hook_robotstxt()and callurl(), it strips the language prefixes from those URLs too. Here's a corrected patch.Comment #9
alex.bukach commentedActually, there's one more issue: some modules (like globalredirect) expect
$optionsto have theprefixkey since it's initialized byurl(). Therefore let's better reset it to the default value instead of unsetting.Comment #10
ccjjmartin commentedI know this is 7.x and not 8.x but I am committing the solution in this thread to the 8.x branch: https://www.drupal.org/project/robotstxt/issues/3157451 (adding some information)
Comment #11
keboca commented@ccjjmartin thank you, I was looking for the solution to 8.x branch