cms_pico
cms_pico copied to clipboard
Local links don't work as expected
I've been creating my notes in .md
files, and I want them to be accessible from the outside world.
I've been using MDwiki, and it works perfectly, but I'd like to give CMS pico a try, because my home server might not be accessible form the outside on port 80 anymore.
Nevertheless, I run into an issue when using local links from the index.md
to another files. If I use [detailed page](detailed_page)
construction (which should work fine, because the file is in the same directory), the link fails, because it is trying to open ../sites/detailed_page
, which obviously doesn't exist. I have to update the links to [detailed page](notes/detailed_page)
, which is very inconsistent.
Why is that? Is there a way to fix it?
P.S.
I also think that the correct construction should be [detailed page](detailed_page.md)
, so that it corresponds with the actual filename (as it should).
Could this be fixed? .
Maybe the apache rewrite rule is at fault here?
If I remember correctly, there is some examples of links in the default template
please reopen this ticket if the last answer does not help
Pico CMS for Nextcloud v1.0.0 is arriving and I'm currently working through some old issues that can be resolved before releasing the app's first stable release. See help.nextcloud.com for more info.
This is an known issue also affecting Pico, thus I'm reopening this Issue for later consideration.
Actually there's no code dealing with paths in Markdown files in Pico, all paths (including relative paths) are taken as-is (even %base_url%
is just a placeholder that is replaced by Pico's base URL before parsing Markdown). So, if you use a link like 
, Pico will parse this to <img src="assets/cats.jpg" alt="Cats" />
. After adding a appropriate base
HTML attribute (e.g. <base href="{{ base_url }}" />
) to the <head>
of your Twig templates (e.g. themes/my_theme/index.twig
), relative paths like the one shown above work just fine.
The problem is that other Markdown editors don't know anything about this and interpret paths relative to the current file. So, for example, if there's a 
in content/sub/page.md
, what file is supposed to be included? It should be assets/cats.jpg
, however, since most Markdown editors treats all paths relative to the current file, they think the path is content/sub/assets/cats.jpg
. This won't work for obvious reasons, in these editors you'd need a path like ../../assets/cats.jpg
, resulting in content/sub/../../assets/cats.jpg
(equals assets/cats.jpg
).
The same applies to any other relative URLs. Thus you should always use Pico's %base_url%
placeholder to make URLs absolute. However, Markdown editors won't understand %base_url%
- so that they appear broken there.
This is related to #43