Skip to content

Commit

Permalink
Merge pull request #369 from nunocoracao/368-bug-likes-in-taxonomies-…
Browse files Browse the repository at this point in the history
…and-terms-is-shared-globally

🐛 fixed likes and view counters for taxonomies and terms
  • Loading branch information
nunocoracao authored Jan 1, 2023
2 parents 516988a + 7049775 commit 8da083a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ <h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .
</section>
{{ end }}
<script>
var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}"
var oid = "views_taxonomy_{{ .Data.Plural }}"
var oid_likes = "likes_taxonomy_{{ .Data.Plural }}"
</script>
{{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/term.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ <h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .
</div>
{{ end }}
<script>
var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}"
var oid = "views_term_{{ .Data.Term }}"
var oid_likes = "likes_term_{{ .Data.Term }}"
</script>
{{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
Expand Down
6 changes: 6 additions & 0 deletions layouts/partials/meta/likes.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<span>
{{ if eq .Kind "taxonomy"}}
<span id="likes_taxonomy_{{ .Page.Data.Plural }}" title="likes">0</span>
{{ else if eq .Kind "term"}}
<span id="likes_term_{{ .Page.Data.Term }}" title="likes">0</span>
{{ else }}
<span id="likes_{{ .File.Path }}" title="likes">0</span>
{{ end }}
<span class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }}</span>
</span>
{{- /* Trim EOF */ -}}
6 changes: 6 additions & 0 deletions layouts/partials/meta/views.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<span>
{{ if eq .Kind "taxonomy"}}
<span id="views_taxonomy_{{ .Page.Data.Plural }}" title="views">0</span>
{{ else if eq .Kind "term"}}
<span id="views_term_{{ .Page.Data.Term }}" title="views">0</span>
{{ else }}
<span id="views_{{ .File.Path }}" title="views">0</span>
{{ end }}
<span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span>
</span>
{{- /* Trim EOF */ -}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hugo-blowfish-theme",
"version": "2.22.1",
"version": "2.22.2",
"description": "Blowfish theme for Hugo",
"scripts": {
"fullinstall": "npm run preinstall && npm install && npm run postinstall",
Expand Down

0 comments on commit 8da083a

Please sign in to comment.