Also, what can be done to imitate something in top menu ( and I think is easier to do ) is to change the vendor/magento/framework/View/Layout.php:_renderBlock() function to include:
if ($name == 'store.menu') {
return 'SOMETHING SHOULD BE THERE';
}
What I found is following:
At "vendor/magento/module-page-cache/Observer/ProcessLayoutRenderElement.php:_wrapEsi() " function there is line:
"'handles' => json_encode($layout->getUpdate()->getHandles())"
And our page identifier becomes following layout handle: "cms_page_view_id_sternbilder/adler". Please note the "/" included. And it seems that because of that "/", something isn't working correctly.
For example, here is the non working version -> https://www.star-registration.com/page_cache/block/esi/blocks/[%22catalog.topnav%22]/handles/[%22default%22,%22cms_page_view%22,%22cms_page_view_id_sternbilder/adler%22]/
Now, if I will change that last "/" to "_" , the url becomes https://www.star-registration.com/page_cache/block/esi/blocks/[%22catalog.topnav%22]/handles/[%22default%22,%22cms_page_view%22,%22cms_page_view_id_sternbilder_adler%22]/ and the block is rendered.
Obviously, this is not a solution to change the CMS pages urls from "/" to "_", so please check this on your side.
For the time being, I have made a hotfix by changing the line mentioned above to:
"'handles' => json_encode(str_replace('/', '_', $layout->getUpdate()->getHandles()))"
Obviously, this is also not the best solution ( because it actually changes the page identifier/layout handle ), and correct way would be to find that function which renders the contents in those urls and see where it fails, but since this seems to be the core bug, I will better leave further investigations/fixes on you. Actually, I have found the place where it gets those blocks from url:
vendor/magento/module-page-cache/Controller/Block.php:_getBlocks() function
When we have that "/" in the url, it returns blocks as"["default","cms_page_view","cms_page_view_id_sternbilder"
Basically it breaks in the "/" part.
So I will leave you guys with this.
Let me know if you have any more questions.
Thanks.
Really, no comments or anything? I think this is quite an important bug since a lot of people will include "/" in CMS page name...
@archonkulis Thank you for report. We cannot reproduce this issue as described on Magento 2.1.8. Please specify the exact version of Magento you installed.
@magento-engcom-team
The version is 2.1.6. Could you check if you can reproduce on that version? If yes, then I guess update will do the trick.
@archonkulis it does not work this way AFAIK. You need to check latest 2.1.x to see if the issue still persists according to your steps, otherwise it will be closed in ~2 weeks.
@archonkulis, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
I can confirm this is not working on Magento 2.1.12 too.