Skip to content

Commit

Permalink
adding navigation to prev/next page in section
Browse files Browse the repository at this point in the history
  • Loading branch information
gferreira committed Sep 15, 2023
1 parent 2e29f57 commit f86eb69
Show file tree
Hide file tree
Showing 29 changed files with 87 additions and 8 deletions.
14 changes: 14 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ description: Fontra user documentation
baseurl: ""
url: https://gferreira.github.io/fontra-docs

collections:
explanations:
output: true
permalink: /:path/
how-tos:
output: true
permalink: /:path/
reference:
output: true
permalink: /:path/
tutorials:
output: true
permalink: /:path/

markdown: kramdown

version: 0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title : Documentation overview
layout : default
permalink : /explanations/documentation/
order : 2
---

<nav aria-label="breadcrumb">
Expand Down Expand Up @@ -71,10 +72,10 @@ fontra-docs
├── _py/
├── css/
├── images/
├── reference/
├── explanations/
├── tutorials/
├── how-tos/
├── _reference/
├── _explanations/
├── _tutorials/
├── _how-tos/
├── index.md
└── 404.html
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Explanations
layout : default
permalink : /explanations/
draft : true
order : 0
---

theoretical knowledge · understanding-oriented · useful when studying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Features overview
layout : default
permalink : /explanations/features/
draft : true
order : 2
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions explanations/welcome.md → _explanations/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Welcome to Fontra
layout : default
permalink : /explanations/welcome-to-fontra/
draft : true
order : 1
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Building Fontra from source
layout : default
permalink : /how-tos/building-fontra-from-source/
draft : true
order : 2
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions how-tos/how-tos.md → _how-tos/how-tos.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : How-Tos
layout : default
permalink : /how-tos/
draft : true
order : 0
---

practical steps · problem-oriented · useful when working
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Installing Fontra Pak on your computer
layout : default
permalink : /how-tos/installing-fontra-pak/
draft : true
order : 1
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Opening a UFO or designspace file in Fontra
layout : default
permalink : /how-tos/opening-ufo-designspace/
draft : true
order : 3
---

<nav aria-label="breadcrumb">
Expand Down
46 changes: 42 additions & 4 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,52 @@
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>
</head>

{% if page.collection %}
{% capture all_pages %}{{ page.collection }}{% endcapture %}
{% assign pages = site[all_pages] | sort: "order" %}
{% for nav_page in pages %}
{% if nav_page.title == page.title %}
{% unless forloop.first %}
{% assign prev_url = prev.url %}
{% assign prev_title = prev.title %}
{% endunless %}
{% unless forloop.last %}
{% assign next = pages[forloop.index] %}
{% assign next_url = next.url %}
{% assign next_title = next.title %}
{% endunless %}
{% endif %}
{% assign prev = nav_page %}
{% endfor %}
{% endif %}

<body class='d-flex flex-column h-100'>
{% include header.html %}
<main class='flex-shrink-0'>
<div class="container px-lg-4 pt-3 pb-4">
{% if page.draft == true %}
<div class="badge text-bg-warning float-end mt-2">draft</div>
{% endif %}
<h1 class='col-12'>{{ page.title }}</h1>

<div class='row'>
<h1 class='col-9'>{{ page.title }}</h1>
{% if page.collection %}
{% if prev_url or next_url %}
<nav class='col-3 mt-2'>
<ul class="pagination pagination-sm float-end">
{% if prev_url %}
<li class="page-item">
<a class="page-link px-3 prev" href="{{ site.url }}/{{prev_url}}" title='{{ prev_title }}'>&laquo;</a>
</li>
{% endif %}
{% if next_url %}
<li class="page-item">
<a class="page-link px-3 next" href="{{ site.url }}/{{next_url}}" title='{{ next_title }}'>&raquo;</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endif %}
</div>

{{ content }}
</div>
</main>
Expand Down
1 change: 1 addition & 0 deletions reference/canvas.md → _reference/canvas.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Canvas
layout : default
permalink : /reference/canvas/
draft : true
order : 2
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/menu.md → _reference/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Menu
layout : default
permalink : /reference/menu/
draft : true
order : 16
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/navigation.md → _reference/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Navigation
layout : default
permalink : /reference/navigation/
draft : true
order : 3
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/panels.md → _reference/panels.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Panels
layout : default
permalink : /reference/panels/
draft : true
order : 9
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Designspace
layout : default
permalink : /reference/panels/designspace
draft : true
order : 12
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Find glyph
layout : default
permalink : /reference/panels/find-glyph
draft : true
order : 11
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Glyph info
layout : default
permalink : /reference/panels/glyph-info
draft : true
order : 15
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Options panel
layout : default
permalink : /reference/panels/options
draft : true
order : 13
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Preview text
layout : default
permalink : /reference/panels/preview-text
draft : true
order : 10
---

<nav aria-label="breadcrumb">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Reference font
layout : default
permalink : /reference/panels/reference-font
draft : true
order : 14
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/reference.md → _reference/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Reference
layout : default
permalink : /reference/
draft : true
order : 0
---

theoretical knowledge · information-oriented · useful when working
Expand Down
1 change: 1 addition & 0 deletions reference/tools.md → _reference/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Tools
layout : default
permalink : /reference/tools/
draft : true
order : 4
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/tools/hand.md → _reference/tools/hand.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Hand tool
layout : default
permalink : /reference/tools/hand
draft : true
order : 8
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/tools/pen.md → _reference/tools/pen.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Pen tool
layout : default
permalink : /reference/tools/pen
draft : true
order : 6
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/tools/pointer.md → _reference/tools/pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Pointer tool
layout : default
permalink : /reference/tools/pointer
draft : true
order : 5
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/tools/ruler.md → _reference/tools/ruler.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Ruler
layout : default
permalink : /reference/tools/ruler
draft : true
order : 7
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions reference/workspace.md → _reference/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Workspace overview
layout : default
permalink : /reference/workspace/
draft : true
order : 1
---

<nav aria-label="breadcrumb">
Expand Down
1 change: 1 addition & 0 deletions tutorials/tutorials.md → _tutorials/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Tutorials
layout : default
permalink : /tutorials/
draft : true
order : 0
---

practical steps · learning-oriented · useful when studying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title : Understanding variable components
layout : default
permalink : /tutorials/understanding-variable-components/
draft : true
order : 1
---

<nav aria-label="breadcrumb">
Expand Down

0 comments on commit f86eb69

Please sign in to comment.