Skip to content

Commit

Permalink
Issue-476: Fix for categories' broken links on GitHub pages (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-baiborodine authored Jan 31, 2023
1 parent b6c5ab0 commit 95f58b0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,7 @@ GitHub.sublime-settings
# End of https://www.gitignore.io/api/node,sass,linux,macos,sublimetext

testing/testing-example-site/public
testing/testing-example-site/public0
testing/testing-example-site/public1
testing/testing-example-site/public2
testing/testing-example-site/public3
testing/testing-example-site/public4
testing/testing-example-site/public*
testing/testing-example-site/resources
testing/testing-example-site/themes

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Hugo Themes](https://img.shields.io/badge/Hugo_Themes-@Bilberry-ff4088)](https://themes.gohugo.io/themes/bilberry-hugo-theme/)

[![Build GH-Pages](https://github.com/Lednerb/bilberry-hugo-theme/workflows/Update%20GitHub%20Pages/badge.svg)](https://github.com/Lednerb/bilberry-hugo-theme/deployments/activity_log?environment=github-pages)
[![Contributors](https://img.shields.io/badge/contributors-45-orange.svg?style=flat-square)](#contributors)
[![Contributors](https://img.shields.io/badge/contributors-46-orange.svg?style=flat-square)](#contributors)
[![License](https://img.shields.io/github/license/Lednerb/bilberry-hugo-theme.svg?style=flat-square)](https://github.com/Lednerb/bilberry-hugo-theme/blob/master/LICENSE.md)

**Bilberry** is a premium [Hugo](https://gohugo.io) theme with many great features.
Expand Down
10 changes: 8 additions & 2 deletions layouts/_default/category.terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

<div class="content">
<div class="article-wrapper u-cf single">
<a class="bubble" href="{{ "/categories/" | relLangURL}}">
{{ with .Site.GetPage "/categories" }}
<a class="bubble" href="{{ .Permalink }}">
<i class="fa fa-fw fa-list"></i>
</a>
{{ end }}

<article class="article">
<div class="content">
<h3>{{ i18n "categories" }}</h3>
<hr>
<ul id="all-categories">
{{ range $name, $taxonomy := .Site.Taxonomies.categories }}
<li><a href="{{ "/categories/" | relLangURL }}{{ $name | urlize }}">{{ $name | humanize }} ({{ $taxonomy.Count }})</a></li>
<li>
{{ with $.Site.GetPage (printf "/categories/%s" $name) }}
<a href="{{ .Permalink }}">{{ .Title }} ({{ $taxonomy.Count }})</a>
{{ end }}
</li>
{{ end }}
</ul>
</div>
Expand Down
14 changes: 10 additions & 4 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@

{{ if and .Site.Taxonomies.categories (gt ( .Site.Params.amountCategoriesInFooter | default 7 ) 0 ) }}
<div class="categories">
<a href="{{ "/categories/" | relLangURL }}"><strong>{{ i18n "categories" }}</strong></a>
{{ with .Site.GetPage "/categories" }}
<a href="{{ .Permalink }}"><strong>{{ .Title }}</strong></a>
{{ end }}

<ul>
{{ range $order, $taxonomy := (first ( .Site.Params.amountCategoriesInFooter | default 7 ) .Site.Taxonomies.categories.ByCount) }}
<li>
<a href="{{ (print "/categories/" ($taxonomy.Name | urlize)) | relLangURL }}">{{ $taxonomy.Name | humanize }}
({{ $taxonomy.Count }})</a>
{{ with $.Site.GetPage (printf "/categories/%s" $taxonomy.Name) }}
<a href="{{ .Permalink }}">{{ .Title }} ({{ $taxonomy.Count }})</a>
{{ end }}
</li>
{{ end }}
</ul>
Expand Down Expand Up @@ -57,7 +61,9 @@

{{ if .Site.Params.showArchive | default true }}
<div class="archive">
<a href="{{ "/archive/" | relLangURL }}"><strong>{{ i18n "archive" }}</strong></a>
{{ with .Site.GetPage "/archive" }}
<a href="{{ .Permalink }}"><strong>{{ .Title }}</strong></a>
{{ end }}
</div>
{{ end }}
</div>
Expand Down
6 changes: 2 additions & 4 deletions testing/testing-example-site/test-theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ testContentAndContinue '<a href="https://example.com/tags/t%C3%A4sting&#43;&#43;
testContentAndContinue '<a href="https://example.com/de/article/t%C3%A4st/">de</a>' "$TARGET_DIR/article/täst/index.html"
testContentAndContinue '<a href="https://example.com/article/t%C3%A4st/">Umlauts Täst&#43;&#43;</a>' "$TARGET_DIR/article/täst/index.html"
testContentAndContinue '<p>This is a umlauts-test in Quotes äüöß++</p>' "$TARGET_DIR/quote/index.html"
testContentAndContinue '<a href="/categories/t%C3%A4st&#43;&#43;">Täst&#43;&#43;
(2)</a>' "$TARGET_DIR/article/täst/index.html"
testContentAndContinue '<a href="https://example.com/categories/t%C3%A4st&#43;&#43;/">Täst&#43;&#43; (2)</a>' "$TARGET_DIR/article/täst/index.html"

# article/täst [de]
echo "## Testing article/täst [de]"
Expand All @@ -107,8 +106,7 @@ testContentAndContinue '<a href="https://example.com/de/tags/t%C3%A4sting&#43;&#
testContentAndContinue '<a href="https://example.com/article/t%C3%A4st/">en</a>' "$TARGET_DIR/de/article/täst/index.html"
testContentAndContinue '<a href="https://example.com/de/article/t%C3%A4st/">de Umlauts Täst&#43;&#43;</a>' "$TARGET_DIR/de/article/täst/index.html"
testContentAndContinue '<p>de This is a umlauts-test in quotes äüöß++</p>' "$TARGET_DIR/de/quote/index.html"
testContentAndContinue '<a href="/de/categories/t%C3%A4st&#43;&#43;">Täst&#43;&#43;
(2)</a>' "$TARGET_DIR/de/article/täst/index.html"
testContentAndContinue '<a href="https://example.com/de/categories/t%C3%A4st&#43;&#43;/">Täst&#43;&#43; (2)</a>' "$TARGET_DIR/de/article/täst/index.html"

# quote/täst-quote [en]
echo "## Testing quote/täst-quote [en]"
Expand Down

0 comments on commit 95f58b0

Please sign in to comment.