Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new option extra.footer.nav.is_absolute_url #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ The following options should be under the `[extra]` in `config.toml`
- `[[extra.menu.social]]` - the social links on the header of the page
- `[extra.footer]` - the footer content on the left
- `[[extra.footer.nav]]` - the footer navigations on the right
- `is_absolute_url` - whether to treat `url` as an absolute url (default to `false`, aka `url` is treated relatively)

### Templates

Expand Down
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@ weight = 10
[[extra.footer.nav]]
name = "Code of Conduct"
url = "/docs/contributing/code-of-conduct/"
is_absolute_url = false
weight = 20
1 change: 1 addition & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@ weight = 10
[[extra.footer.nav]]
name = "Code of Conduct"
url = "/docs/contributing/code-of-conduct/"
is_absolute_url = false
weight = 20
6 changes: 5 additions & 1 deletion templates/macros/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<ul class="list-inline">
{% if config.extra.footer.nav %}
{% for val in config.extra.footer.nav %}
<li class="list-inline-item"><a href="{{ get_url(path=val.url, trailing_slash=true) | safe }}">{{ val.name }}</a></li>
{% if val.is_absolute_url %}
<li class="list-inline-item"><a href="{{ val.url | safe }}">{{ val.name }}</a></li>
{% else %}
<li class="list-inline-item"><a href="{{ get_url(path=val.url, trailing_slash=true) | safe }}">{{ val.name }}</a></li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
Expand Down