-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Issue #2802, #1146: Fixing sitemap generation folder #9094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #2802, #1146: Fixing sitemap generation folder #9094
Conversation
@@ -41,10 +42,13 @@ public function __construct( | |||
\Magento\Framework\Filesystem $filesystem, | |||
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, | |||
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, | |||
\Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, update doc block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
*/ | ||
class DocumentRoot | ||
{ | ||
private $config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add doc block here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -34,10 +41,13 @@ public function __construct( | |||
\Magento\Backend\Block\Context $context, | |||
\Magento\Sitemap\Model\SitemapFactory $sitemapFactory, | |||
\Magento\Framework\Filesystem $filesystem, | |||
\Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, update doc block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@okorshenko: we updated the PR per your comments. |
…9094 - restored original file content
…9094 - fixed static tests
…9094 - fixed static tests
…9094 - fixed static tests
@JosephMaxwell thank you for your contribution. Your Pull Request has been successfully merged |
@magento/community-gatekeepers @JosephMaxwell how other developers should learn about this configuration in env.php |
Hi @sereban |
Hi @JosephMaxwell, I added the following to my env.php:
After clicking "Generate" the URL still contains /pub/ but the sitemap works with and without /pub:
Is this the expected result? |
@okorshenko What about said documentation? I can't find it... |
@okorshenko Any documentation available? This issue still exists in 2.2.5. |
It would be great to find documentation about that in the dev docs. I only found that: Is the |
2.2.9 and the issue persists. Nginx/Apache Docroot is set to /pub folder. document_root_is_pub in env.php does not make any difference. What am I missing here? |
Description
Magento assumes for the above tickets that
robots.txt
and the sitemap paths are to be found in the root directory. To get the sitemap to be generated in thepub
folder (per Magento's recommendation), you need to set the base directory to be at leastpub/
. This resolves the issue by adding new configuration toapp/etc/env.php
:The default keeps backward compatibility: if the value is not specified, original functionality remains (use of the root directory). If you specify
document_root_is_pub
and set it totrue
, the sitemap is located in the correct directory.Fixed Issues
This is a fix for:
Manual testing scenarios
Before:
/pub
.After: