Convert page names from custom variable to url

Hello all,

I’m writing an online documentation for a software and I would like the viewer of the documentation to go on Next or previous page in the documentation order.

On each page, I defined a next and previous variables:

title: Overview
layout: doc
previous: _index.md
next: install.md

In the custom layout “doc.html”, I defined: this:

<a href="{{ .Page.Params.previous  }}">Previous</a>
<a href="{{ .Page.Params.next  }}">Next</a>

The links are displayed on the page but they point to the wrong file, that leads to 404.
I would like to know how can I convert my strings previous and next to get the real path.
Also my website should be translation friendly. So I need a solution that allows translation.

I have to translate previous and next also.

Thanks!

If this were my site, I would specify a page weight and use Prev and Next.

Mmm… I didn’t know this mechanism exists. Thanks I will give it a try.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.