pages in subdirectory not showing
leolivier opened this issue · 5 comments
Hi
I'm trying your very good looking theme (just made PR about using %assets_url%).
I'm facing an issue I don't understand.
When I create a page in a sub directory, the page appears in the "menu" but does not show when I click on it. I looked at the generated HTML code which seems ok.
As I wondered if it was due to the presence of a / in the anchor, I saved the HTML file on my disk (w/o the CSS) and executed it and it works (it goes to the right article) so I suspect this is a CSS issue but I don't get it...
Edit: this is not linked to the article itself: if I store it at the root of the pico site, it works...
Hi @leolivier, Thanks for your interest in the dimension theme
I found an issue in the console: (en/xperiences_it is the anchor, en is the subdirectory and xperiences_it.md the page in this directory):
Error: Syntax error, unrecognized expression: #en/xperiences_it jquery.min.js:2:12731
jQuery 9
<anonyme> https://blog.levillain.ml/apps/cms_pico/appdata_public/themes/z7o3sRyPTL/dimension/assets/js/main.min.js:1
jQuery 2
dispatch
handle
As it seems to be an error inside JQuery (although I'm not really sure), I managed to fix this by replacing the '/' by a '-' in the anchor use a replace filter like this:
<li><a href="#{{ page.id | replace('/','-') }}">{{ page.title }}</a></li>
and
<article id="{{ page.id | replace('/','-') }}">
in index.twig.
Can do a PR if you want...
@leolivier
code which you posted not working for me. But your analysis was wonderful. I would never have found it on my own.
This one works:
<li><a href="#{{ page.id | replace({'/':'-'}) }}">{{ page.title }}</a></li>
and
<article id="{{ page.id | replace({'/':'-'}) }}">