Skip to content

Commit

Permalink
fix: add baseurl to top level links
Browse files Browse the repository at this point in the history
  • Loading branch information
braddialpad committed Apr 21, 2022
1 parent a7f7faa commit 835a881
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions docs/_data/site-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
sections: [
{
title: "About",
url: `about/dialtone/`,
url: `${Site.baseurl}about/dialtone/`,
subsections: [
{
title: "About",
Expand All @@ -27,7 +27,7 @@ module.exports = {
},
{
title: "Getting Started",
url: `getting-started/installation/`,
url: `${Site.baseurl}getting-started/installation/`,
subsections: [
{
title: "Getting Started",
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = {
},
{
title: "Design",
url: `design/colors/color-palette`,
url: `${Site.baseurl}design/colors/color-palette`,
subsections: [
{
title: "Colors",
Expand Down Expand Up @@ -147,7 +147,7 @@ module.exports = {
},
{
title: "Utilities",
url: `utilities/backgrounds/attachment`,
url: `${Site.baseurl}utilities/backgrounds/attachment`,
subsections: [
{
title: "Backgrounds",
Expand Down Expand Up @@ -521,7 +521,7 @@ module.exports = {
},
{
title: "Components",
url: `components/avatar`,
url: `${Site.baseurl}components/avatar/`,
pages: [
{
title: "Avatar",
Expand Down
10 changes: 5 additions & 5 deletions docs/_includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<div class="d-of-y-scroll d-zi-navigation d-ps-fixed d-b0 d-pt24 d-w216 d-pb48 js-navigation-sidebar">
{% if site-nav %}
{% for section in site-nav.sections %}
{% assign pageUrlNoSlash = page.url | remove_first: '/' %}
{% assign slug = page.url | replace: '/',' ' | truncatewords: 2 | remove:'...' %}
{% assign url = section.url | replace: '/',' ' | truncatewords: 1 | remove:'...' %}
{% assign pageUrl = page.url | remove_first: '/' %}
{% assign slug = site.baseurl | append: pageUrl %}
{% assign url = section.url | split: '/' | slice: 0, -2 | join: '/' %}
{% if slug contains url %}
<!-- This is for navigation that doesn't categorize its nav items -->
{% if section.pages %}
<ul id="nav" class="d-ls-reset d-px16 d-stack4">
{% for item in section.pages %}
<li>
<a class="d-link d-td-none d-d-block d-px8 d-py4 d-fs14 d-lh6 d-bar4{% if pageUrlNoSlash == item.url %} d-bgc-purple-100 d-bgo50{% endif %}" href="{{ item.url }}">{{ item.title }}</a>
<a class="d-link d-td-none d-d-block d-px8 d-py4 d-fs14 d-lh6 d-bar4{% if pageUrl == item.url %} d-bgc-purple-100 d-bgo50{% endif %}" href="{{ item.url }}">{{ item.title }}</a>
</li>
{% endfor %}
</ul>
Expand All @@ -26,7 +26,7 @@
<ul class="d-ls-reset d-stack4">
{% for link in subsection.pages %}
<li>
<a class="d-link d-td-none d-d-block d-px8 d-py4 d-fs14 d-lh6 d-bar4{% if pageUrlNoSlash == link.url %} d-bgc-purple-100 d-bgo50{% endif %}" href="{{ link.url }}">{{ link.title }}</a>
<a class="d-link d-td-none d-d-block d-px8 d-py4 d-fs14 d-lh6 d-bar4{% if pageUrl == link.url %} d-bgc-purple-100 d-bgo50{% endif %}" href="{{ link.url }}">{{ link.title }}</a>
</li>
{% endfor %}
</ul>
Expand Down

0 comments on commit 835a881

Please sign in to comment.