Skip to content

Commit

Permalink
[Dev docs] Fix previous and next page links (#1601)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nguyenhuy authored Jul 29, 2019
1 parent 6608f46 commit 0568a53
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 31 deletions.
7 changes: 0 additions & 7 deletions docs/_docs/development/cell-node-lifecycle.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/_docs/development/collection-animations.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/_docs/development/collection-asynchronous-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Collections and asynchronous updates
layout: docs
permalink: /development/collection-asynchronous-updates.html
prevPage: layout-specs.html
---

# At a glance
Expand Down
2 changes: 2 additions & 0 deletions docs/_docs/development/how-to-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: How to debug issues in Texture
layout: docs
permalink: /development/how-to-debug.html
prevPage: how-to-develop.html
nextPage: threading.html
---

# Debug
Expand Down
7 changes: 0 additions & 7 deletions docs/_docs/development/structure.md

This file was deleted.

4 changes: 1 addition & 3 deletions docs/_docs/development/threading.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
title: Threading
layout: docs
permalink: /development/threading.html
prevPage: how-to-develop.html
prevPage: how-to-debug.html
nextPage: node-lifecycle.html
---

# Threading

## At a glance

The Texture philosophy is about efficient utilization of resources in order to provide a high frame rate user experience. In other words, an almost scientific approach to distributing work amongst threads keeps the Default Run Loop lean to allow user input events and to consume work scheduled on the main dispatch queue.
Expand Down
36 changes: 29 additions & 7 deletions docs/_layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<div class="content">
<h1>
{{ page.title }}
{{ page.title }}
</h1>
<p>{{ page.description }}</p>

Expand All @@ -23,12 +23,34 @@ <h1>


<div class="docs-prevnext">
{% if page.prevPage %}
<a href="/docs/{{ page.prevPage }}">&larr; Prev</a>
{% endif %}
{% if page.nextPage %}
<a class="right" href="/docs/{{ page.nextPage }}">Next &rarr;</a>
{% endif %}
{% 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>
Expand Down

0 comments on commit 0568a53

Please sign in to comment.