diff --git a/CHANGELOG.md b/CHANGELOG.md index e0fca22f..78e14408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ All notable changes to this project will be documented in this file. - :bento: Fix: update webfonts for fontawesome 6.2.0 (@NicoDreamzZ[#228](https://github.com/hugo-fixit/FixIt/pull/228)) - :bug: Fix: image shortcode/plugin lose the support for svg type files ([#210](https://github.com/hugo-fixit/FixIt/issues/210)) - :bug: Fix: can't keep the static table of the contents in front of the post +- :bug: Fix: escape hashtag character `#` in tag and category ([#245](https://github.com/hugo-fixit/FixIt/issues/245)) - :lipstick: Style: refactor css style - :lipstick: Style: update home page stylesheet - :wrench: Chore(deps-dev): diff --git a/assets/css/_page/_home.scss b/assets/css/_page/_home.scss index 99f26f3b..67452f0e 100644 --- a/assets/css/_page/_home.scss +++ b/assets/css/_page/_home.scss @@ -177,6 +177,11 @@ padding: 0; @include link(true, true); + + .post-tag:not(:last-child)::after { + content: ','; + margin-right: 0.25rem; + } } } } diff --git a/assets/css/_partials/_single/_footer.scss b/assets/css/_partials/_single/_footer.scss index 7f119327..3c98b1f7 100644 --- a/assets/css/_partials/_single/_footer.scss +++ b/assets/css/_partials/_single/_footer.scss @@ -73,6 +73,13 @@ * { display: inline; } + + @include link(true, true); + + .post-tag:not(:last-child)::after { + content: ','; + margin-right: 0.25rem; + } } .post-nav { diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index f10e8a99..1a7871fe 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -43,7 +43,7 @@ {{- $categories := slice -}} {{- range .Params.categories -}} {{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}} - {{- $categories = $categories | append (printf `%v %v` $category.RelPermalink (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}} + {{- $categories = $categories | append (printf `%v %v` (replace $category.RelPermalink "#" "%23") (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}} {{- end -}} {{- with delimit $categories " " -}}   @@ -66,11 +66,12 @@ {{ T "readMore" }} {{- with .Params.tags -}}
- {{- dict "Class" "fa-solid fa-tags fa-fw" | partial "plugin/icon.html" -}}  - {{- range $index, $value := . -}} - {{- if gt $index 0 }}, {{ end -}} + {{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}} + {{- range $value := . -}} {{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}} - {{ $tag.Title }} + {{- with $tag -}} + + {{- end -}} {{- end -}}
{{- end -}} diff --git a/layouts/partials/function/path.html b/layouts/partials/function/path.html index ece426fe..0a5efd19 100644 --- a/layouts/partials/function/path.html +++ b/layouts/partials/function/path.html @@ -1,3 +1,4 @@ {{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}} -{{- $URL := . | urlize | urls.Parse -}} +{{- /* https://github.com/hugo-fixit/FixIt/issues/245 */ -}} +{{- $URL := . | urlize | urlquery | urls.Parse -}} {{- return $URL.Path -}} diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index c11314af..f9d5f879 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -59,11 +59,12 @@
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 31c37db8..6496253d 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -52,7 +52,7 @@ {{- $categories := slice -}} {{- range .Params.categories -}} {{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}} - {{- $categories = $categories | append (printf `%v %v` $category.RelPermalink (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}} + {{- $categories = $categories | append (printf `%v %v` (replace $category.RelPermalink "#" "%23") (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}} {{- end -}} {{- with delimit $categories " " }}