Directory relative links between pages

I am trying to generate links between pages using the method explained in

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/ 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/ generates /
[Some link](01.grass) generates /
[Some link](/ generates /

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/ 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:

[Some link](/green/grass)

That’s all there is to it.

Yes, but we have different needs for inter-page linking and were hoping the methods described in would work.

  1. Using the proposed slug method would still not resolve the link to be rendered with the default route set in the page header:
title: A web page
   default: /my/web/1234-page-with-a-very-long-url-which-may-change
  1. Are the methods for directory relative and absolute page linking described in actually working?

The examples described in the documentation are

  1. 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 [../../](../../
* up more and down more no filename but hash [../../](../../
* up and down no filename [../03.assets](../03.assets)
* up more and down more no filename but query + hash [../../](../../
* file link [../../](../../ {.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: [/](/
* absolute with relative: [/08.test/../](/08.test/../
* absolute link + query: [/blog/focus-and-blur?foo=bar](/blog/focus-and-blur?foo=bar)
* absolute with paths + query: [/](/

### 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]
* [][r_external]

### Other link types

* [](
* [tel:1-555-223-2323](tel:1-555-223-2323)
* [sms:1-555-223-2323](sms:1-555-223-2323)
* [](

### Remote

* remote http: [](
* remote https: [](

BTW I did commit a fix to add the active language to prefix the links as I missed this when doing the multilang implementation.

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. <- this one should do it.

Not sure what’s wrong with my installation. I added a directory /user/page/ with a file
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/ 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.

Nope, shouldn’t need anything special.

Can you do me a favor, please zip up your site, drop it on dropbox (or similar) and send me a link to andy at getgrav dot org.

Then I’ll check it out on my local and see if I can spot what’s going on.