None of the methods (directory relative nor absolute) I tried resolve the link correctly and the URL is the unprocessed/unresolved directory entry rather the page’s default route.
For example if I have a page in /pages/02.green/01.grass/default.md I expected to get the url configured as default route when generating links or the slug if no default route given.
But when using:
[Some link](01.grass/default.md) generates /02.green/01.grass/default.md
or [Some link](01.grass) generates /02.green/01.grass
or [Some link](/02.green/01.grass) generates /02.green/01.grass
Is there a setting I overlooked which turns on link processing?
First, it’s much better not to use the actual folder directories. This is because if you change the directory or change the ordering, it will break your links. Better to use the route.
So, for your example page in pages/02.green/01.grass/default.md the route to this (as shown in your browser) is: /green/grass. So from some other page the simplest way to reach this page is via:
I am hoping for a method which can generate the default route of a page based on some form of handle or identifier. It does not matter for us if that is the file name or the slug or even a page id of some form. This all should work in a multi-languag e context were the default routes are different for the languages but still the page’s file name, slug or handler or id would be the same.
Well in my test they are all working fine. Obviously the example below is based on my testing site, but you can get an idea of the various link types:
### Directory relative
* just down [01.item2-1](01.item2-1)
* just up [..](..)
* file link with [../../03.blog/2015-01-11-atom-vs-coda/item.md](../../03.blog/2015-01-11-atom-vs-coda/item.md)
* up more and down more no filename but hash [../../03.blog/focus-and-blur#something](../../03.blog/focus-and-blur#something)
* up and down no filename [../03.assets](../03.assets)
* up more and down more no filename but query + hash [../../03.blog/focus-and-blur?foo=bar#something](../../03.blog/focus-and-blur?foo=bar#something)
* file link [../../03.blog/focus-and-blur/item.md](../../03.blog/focus-and-blur/item.md) {.button}
### Slug relative
* up and down with [../../blog/atom-vs-coda](../../blog/atom-vs-coda)
* up and down with param [../../blog/tag:birds](../../blog/tag:birds)
* up and down with anchor [../smartypants#someanchor](../smartypants#someanchor)
* up and down with query [../smartypants?foo=bar&cat=brown](../smar typants?foo=bar&cat=brown)
* up and down into smartypants [../smartypants](../smartypants)
* up more and down more [../../blog/focus-and-blur](../../blog/focus-and-blur)
* just down [item2-1](item2-1)
<a name="test" class="anchor"></a>
## Absolute
* absolute link: [/blog/focus-and-blur](/blog/focus-and-blur)
* absolute link with param: [/blog/tag:birds](/blog/tag:birds)
* absolute with paths: [/03.blog/2015-01-11-atom-vs-coda/item.md](/03.blog/2015-01-11-atom-vs-coda/item.md)
* absolute with relative: [/08.test/../03.blog/2015-01-11-atom-vs-coda/item.md](/08.test/../03.blog/2015-01-11-atom-vs-coda/item.md)
* absolute link + query: [/blog/focus-and-blur?foo=bar](/blog/focus-and-blur?foo=bar)
* absolute with paths + query: [/03.blog/2015-01-11-atom-vs-coda/item.md?foo=bar](/03.blog/2015-01-11-atom-vs-coda/item.md?foo=bar)
### Hash Links
* relative hash [../page-links#test](../page-links#test)
* relative hash [../page-links/#test](../page-links/#test)
* just a [#test](#test)
* root hash [/#test](/#test)
### Reference links
* [../03.assets#blah][r_relative]
* [/blog/focus-and-blur#blah][r_absolute]
* [http://www.cnn.com][r_external]
### Other link types
* [xmpp:tim@boese-ban.de](xmpp:tim@boese-ban.de)
* [tel:1-555-223-2323](tel:1-555-223-2323)
* [sms:1-555-223-2323](sms:1-555-223-2323)
* [mailto:blah@blah.com](mailto:blah@blah.com)
### Remote
* remote http: [http://www.cnn.com](http://www.cnn.com)
* remote https: [https://github.com](https://github.com)
Scratch that last commit, had to roll that back as it broke image links. I’ll look to find a way to add active language prefix for markdown links only.
Not sure what’s wrong with my installation. I added a directory /user/page/03.blog/2015-01-11-atom-vs-coda with a file item.md
and then this markdown link to the home page which I copied from above example:
but the link resolves to simply plain-text http://localhost/03.blog/2015-01-11-atom-vs-coda/item.md with a 404 of course instead of the correct http://localhost/blog/2015-01-11-atom-vs-coda
Is there a plugin of some sort which must be installed/enabled for link generation? Grav is latest 0.9.42.