Files
Huy Nguyen 0568a537d9 [Dev docs] Fix previous and next page links (#1601)
Our pages are organized in 2 dirs: /docs/ and /development/.

Within a dir, prevPage and nextPage are relative (to the dir) so its path should be appended to their href links (see docs/_layouts/docs.html). The dir is available in the page's permalink var.

Some prevPage and nextPage point to a page in a different dir in which case they must not be relative. Instead they must include the other dir's path and thus their links won't be modified.

Also removed some pages that are no longer needed and fixed some prevPage and nextPage values.

I tested this diff locally and all links worked fine.
2019-07-29 12:09:19 -07:00

63 lines
2.0 KiB
HTML
Executable File

---
sectionid: docs
---
{% include header.html %}
<div class="container container-margin">
<div class="sidebar">
{% include nav_docs.html %}
{% include nav_development.html %}
</div>
<div class="content">
<h1>
{{ page.title }}
</h1>
<p>{{ page.description }}</p>
{{ content }}
<p><a class="edit-page-link btn" href="https://github.com/texturegroup/texture/tree/master/docs/{{ page.relative_path }}" target="_blank">Edit on GitHub</a></p>
<div class="docs-prevnext">
{% if page.prevPage %}
{% comment %}
If prevPage already contains the dir, either /docs/ or /development/, don't append to it.
Otherwise, it's a relative path so append the dir according to the page's permalink.
{% endcomment %}
{% if page.prevPage contains '/docs/' or page.prevPage contains '/development/' %}
<a href="{{ page.prevPage }}">&larr; Prev</a>
{% elsif page.permalink contains '/docs/' %}
<a href="/docs/{{ page.prevPage }}">&larr; Prev</a>
{% else %}
<a href="/development/{{ page.prevPage }}">&larr; Prev</a>
{% endif %}
{% endif %}
{% if page.nextPage %}
{% comment %}
Same deal for nextPage.
{% endcomment %}
{% if page.nextPage contains '/docs/' or page.nextPage contains '/development/' %}
<a class="right" href="{{ page.nextPage }}">Next &rarr;</a>
{% elsif page.permalink contains '/docs/' %}
<a class="right" href="/docs/{{ page.nextPage }}">Next &rarr;</a>
{% else %}
<a class="right" href="/development/{{ page.nextPage }}">Next &rarr;</a>
{% endif %}
{% endif %}
</div>
<a id="_"></a>
</div>
<div style="clear:both;"></div>
</div>
{% include footer.html %}