mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-02-02 03:22:33 -06:00
commit
0f262e87d8
16 changed files with 388 additions and 253 deletions
106
assets/js/page.js
Normal file
106
assets/js/page.js
Normal file
|
@ -0,0 +1,106 @@
|
|||
var liked_page = false
|
||||
|
||||
if (typeof auth !== 'undefined') {
|
||||
var id = oid ? oid.replaceAll("/", "-") : oid
|
||||
var viewed = localStorage.getItem(id);
|
||||
|
||||
if (!viewed) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('views').doc(id)
|
||||
localStorage.setItem(id, true);
|
||||
docRef.get().then((doc) => {
|
||||
if (doc.exists) {
|
||||
db.collection('views').doc(id).update({
|
||||
views: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('views').doc(id).set({ views: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
var liked = localStorage.getItem(id_likes);
|
||||
|
||||
if (liked) {
|
||||
liked_page = true
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_page = true
|
||||
localStorage.setItem(id_likes, true);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function remove_like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_page = false
|
||||
localStorage.removeItem(id_likes);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = "\xa0Like"
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(-1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 0 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function process_article() {
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
if (!liked_page) {
|
||||
like_article(id_likes)
|
||||
} else {
|
||||
remove_like_article(id_likes)
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@ enableCodeCopy = true
|
|||
# mainSections = ["section1", "section2"]
|
||||
# robots = ""
|
||||
|
||||
#defaultBackgroundImage = "IMAGE.jpg" # used as default for background images
|
||||
|
||||
[header]
|
||||
layout = "basic" # valid options: basic, fixed
|
||||
|
||||
|
@ -83,6 +85,24 @@ enableCodeCopy = true
|
|||
|
||||
[taxonomy]
|
||||
showTermCount = true
|
||||
#showHero = true
|
||||
#heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
||||
showBreadcrumbs = false
|
||||
#showViews = false
|
||||
#showLikes = false
|
||||
#showTableOfContents = true
|
||||
#cardView = false
|
||||
|
||||
[term]
|
||||
#showHero = true
|
||||
#heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
||||
showBreadcrumbs = false
|
||||
#showViews = false
|
||||
#showLikes = false
|
||||
#showTableOfContents = true
|
||||
#groupByYear = false
|
||||
#cardViewScreenWidth = false
|
||||
#cardView = false
|
||||
|
||||
[firebase]
|
||||
# apiKey = "XXXXXX"
|
||||
|
|
|
@ -15,6 +15,8 @@ enableCodeCopy = true
|
|||
mainSections = ["docs"]
|
||||
# robots = ""
|
||||
|
||||
defaultBackgroundImage = "/img/iceland.jpg"
|
||||
|
||||
[header]
|
||||
layout = "fixed" # valid options: basic, fixed
|
||||
|
||||
|
@ -82,6 +84,24 @@ mainSections = ["docs"]
|
|||
|
||||
[taxonomy]
|
||||
showTermCount = true
|
||||
showHero = true
|
||||
heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
||||
showBreadcrumbs = false
|
||||
showViews = true
|
||||
showLikes = true
|
||||
showTableOfContents = true
|
||||
|
||||
[term]
|
||||
showHero = true
|
||||
heroStyle = "background" # valid options: basic, big, background, thumbAndBackground
|
||||
showBreadcrumbs = false
|
||||
showViews = true
|
||||
showLikes = true
|
||||
showTableOfContents = true
|
||||
groupByYear = false
|
||||
cardView = false
|
||||
cardViewScreenWidth = false
|
||||
|
||||
|
||||
[firebase]
|
||||
apiKey = "AIzaSyB5tqlqDky77Vb4Tc4apiHV4hRZI18KGiY"
|
||||
|
|
|
@ -193,6 +193,21 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
|||
| `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
|
||||
| `sitemap.excludedKinds` | `["taxonomy", "term"]` | Kinds of content that should be excluded from the generated `/sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values. |
|
||||
| `taxonomy.showTermCount` | `true` | Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing. |
|
||||
| `taxonomy.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each taxonomy page. |
|
||||
| `taxonomy.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. |
|
||||
| `taxonomy.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the taxonomy header. |
|
||||
| `taxonomy.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. |
|
||||
| `taxonomy.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. |
|
||||
| `taxonomy.showTableOfContents` | `false` | Whether or not the table of contents is displayed on taxonomies. |
|
||||
| `term.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each term page. |
|
||||
| `term.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. |
|
||||
| `term.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the term header. |
|
||||
| `term.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. |
|
||||
| `term.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. |
|
||||
| `term.showTableOfContents` | `false` | Whether or not the table of contents is displayed on terms. |
|
||||
| `term.groupByYear` | `false` | Whether or not articles are grouped by year on term pages. |
|
||||
| `term.cardView` | `false` | Display lists as a gallery of cards. |
|
||||
| `term.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
|
||||
| `firebase.apiKey` | _Not set_ | Firebase apiKey, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
|
||||
| `firebase.authDomain` | _Not set_ | Firebase authDomain, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
|
||||
| `firebase.projectId` | _Not set_ | Firebase projectId, required to integrate against Firebase. Check [this page]({{< ref "firebase-views" >}}) for a guide on how to integrate Firebase into Blowfish. |
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: advanced
|
||||
title: Advanced
|
||||
---
|
||||
|
||||
This is the advanced tag. Just like other listing pages in Blowfish, you can add custom content to individual taxonomy terms and it will be displayed at the top of the term listing. :rocket:
|
||||
|
|
BIN
exampleSite/content/tags/advanced/featured.png
Normal file
BIN
exampleSite/content/tags/advanced/featured.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 636 KiB |
Binary file not shown.
After Width: | Height: | Size: 782 KiB |
Binary file not shown.
After Width: | Height: | Size: 950 KiB |
|
@ -36,120 +36,12 @@
|
|||
{{ .Content | emojify }}
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var liked_article = false
|
||||
|
||||
if (typeof auth !== 'undefined') {
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var id = oid ? oid.replaceAll("/", "-") : oid
|
||||
|
||||
var viewed = localStorage.getItem(id);
|
||||
|
||||
if (!viewed) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('views').doc(id)
|
||||
localStorage.setItem(id, true);
|
||||
docRef.get().then((doc) => {
|
||||
if (doc.exists) {
|
||||
db.collection('views').doc(id).update({
|
||||
views: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('views').doc(id).set({ views: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
|
||||
var liked = localStorage.getItem(id_likes);
|
||||
|
||||
if (liked) {
|
||||
liked_article = true
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_article = true
|
||||
localStorage.setItem(id_likes, true);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function remove_like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_article = false
|
||||
localStorage.removeItem(id_likes);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = "\xa0Like"
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(-1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 0 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function process_article() {
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
if (!liked_article) {
|
||||
like_article(id_likes)
|
||||
} else {
|
||||
remove_like_article(id_likes)
|
||||
}
|
||||
}
|
||||
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
</script>
|
||||
{{ $jsPage := resources.Get "js/page.js" }}
|
||||
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
|
||||
</section>
|
||||
{{ if gt .Pages 0 }}
|
||||
|
||||
|
@ -168,9 +60,7 @@
|
|||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
||||
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }}
|
||||
<h2 class="mt-12 mb-5 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||
|
@ -239,5 +129,4 @@
|
|||
|
||||
{{ partial "pagination.html" . }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
|
@ -38,120 +38,12 @@
|
|||
{{ partial "series-closed.html" . }}
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var liked_article = false
|
||||
|
||||
if (typeof auth !== 'undefined') {
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var id = oid ? oid.replaceAll("/", "-") : oid
|
||||
|
||||
var viewed = localStorage.getItem(id);
|
||||
|
||||
if (!viewed) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('views').doc(id)
|
||||
localStorage.setItem(id, true);
|
||||
docRef.get().then((doc) => {
|
||||
if (doc.exists) {
|
||||
db.collection('views').doc(id).update({
|
||||
views: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('views').doc(id).set({ views: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
|
||||
var liked = localStorage.getItem(id_likes);
|
||||
|
||||
if (liked) {
|
||||
liked_article = true
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_article = true
|
||||
localStorage.setItem(id_likes, true);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 1 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function remove_like_article(id_likes) {
|
||||
auth.signInAnonymously()
|
||||
.then(() => {
|
||||
var docRef = db.collection('likes').doc(id_likes)
|
||||
docRef.get().then((doc) => {
|
||||
liked_article = false
|
||||
localStorage.removeItem(id_likes);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = "\xa0Like"
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(-1)
|
||||
});
|
||||
} else {
|
||||
db.collection('likes').doc(id_likes).set({ likes: 0 })
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error getting document:", error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
console.error(errorCode, errorMessage)
|
||||
});
|
||||
}
|
||||
|
||||
function process_article() {
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
var id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes
|
||||
if (!liked_article) {
|
||||
like_article(id_likes)
|
||||
} else {
|
||||
remove_like_article(id_likes)
|
||||
}
|
||||
}
|
||||
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
</script>
|
||||
{{ $jsPage := resources.Get "js/page.js" }}
|
||||
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
|
||||
</section>
|
||||
<footer class="pt-8 max-w-prose print:hidden">
|
||||
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
{{ define "main" }}
|
||||
|
||||
{{ .Scratch.Set "scope" "list" }}
|
||||
{{ if .Site.Params.taxonomy.showHero | default false }}
|
||||
{{ $heroStyle := print "partials/hero/" .Site.Params.taxonomy.heroStyle ".html" }}
|
||||
{{ if templates.Exists $heroStyle }}
|
||||
{{ partial $heroStyle . }}
|
||||
{{ else }}
|
||||
{{ partial "partials/hero/basic.html" . }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $toc := and (.Params.showTableOfContents | default (.Site.Params.taxonomy.showTableOfContents | default false)) (in
|
||||
.TableOfContents "<ul") }}
|
||||
|
||||
<header>
|
||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
|
||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.taxonomy.showBreadcrumbs | default false) }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
{{ end }}
|
||||
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
||||
<h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
||||
<div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
|
||||
{{ partial "article-meta-taxonomy.html" (dict "context" . "scope" "single") }}
|
||||
</div>
|
||||
</header>
|
||||
{{ if .Content }}
|
||||
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
|
||||
|
@ -12,6 +29,13 @@
|
|||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
<script>
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
</script>
|
||||
{{ $jsPage := resources.Get "js/page.js" }}
|
||||
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
|
||||
<section class="flex flex-wrap max-w-prose -mx-2 overflow-hidden">
|
||||
{{ range .Data.Terms }}
|
||||
<article class="w-full px-2 my-3 overflow-hidden sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/4">
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
{{ define "main" }}
|
||||
|
||||
{{ .Scratch.Set "scope" "list" }}
|
||||
{{ if .Site.Params.term.showHero | default false }}
|
||||
{{ $heroStyle := print "partials/hero/" .Site.Params.term.heroStyle ".html" }}
|
||||
{{ if templates.Exists $heroStyle }}
|
||||
{{ partial $heroStyle . }}
|
||||
{{ else }}
|
||||
{{ partial "partials/hero/basic.html" . }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $toc := and (.Params.showTableOfContents | default (.Site.Params.term.showTableOfContents | default false)) (in
|
||||
.TableOfContents "<ul") }}
|
||||
|
||||
<header>
|
||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
|
||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.term.showBreadcrumbs | default false) }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
{{ end }}
|
||||
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
||||
<h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
|
||||
<div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
|
||||
{{ partial "article-meta-term.html" (dict "context" . "scope" "single") }}
|
||||
</div>
|
||||
</header>
|
||||
{{ if .Content }}
|
||||
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
|
||||
|
@ -12,18 +29,98 @@
|
|||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
<section class="mt-5 space-y-10 w-full">
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }}
|
||||
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||
{{ .Key }}
|
||||
</h2>
|
||||
<hr class="border-dotted w-36 border-neutral-400" />
|
||||
{{ end }}
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-link.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "pagination.html" . }}
|
||||
{{ end }}
|
||||
<script>
|
||||
var oid = "views_{{ .File.Path }}"
|
||||
var oid_likes = "likes_{{ .File.Path }}"
|
||||
</script>
|
||||
{{ $jsPage := resources.Get "js/page.js" }}
|
||||
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
|
||||
|
||||
{{ if gt .Pages 0 }}
|
||||
|
||||
{{ if .Params.cardView | default (.Site.Params.term.cardView | default false) }}
|
||||
|
||||
{{ $cardViewScreenWidth := .Site.Params.term.cardViewScreenWidth}}
|
||||
|
||||
{{ if not $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
|
||||
{{ if $cardViewScreenWidth }}
|
||||
<section class="relative w-screen" style="left: calc(-50vw + 50%);">
|
||||
<div class="flex flex-wrap pl-8 pr-8">
|
||||
{{ else }}
|
||||
<section class="w-full">
|
||||
<div class="flex flex-wrap">
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
<h2 class="mt-12 mb-5 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||
{{ .Key }}
|
||||
</h2>
|
||||
{{ else }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
|
||||
{{ if $cardViewScreenWidth}}
|
||||
<section class="relative w-screen" style="left: calc(-50vw + 50%);">
|
||||
<div class="flex flex-wrap pl-8 pr-8">
|
||||
{{ else }}
|
||||
<section class="w-full">
|
||||
<div class="flex flex-wrap">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range .Pages }}
|
||||
|
||||
{{ if $cardViewScreenWidth }}
|
||||
<div class="flex flex-wrap w-full p-4 sm:w-1/2 md:w-1/3 xl:w-1/4 2xl:w-1/5">
|
||||
{{ else }}
|
||||
<div class="flex flex-wrap w-full p-4 sm:w-1/2 md:w-1/3">
|
||||
{{ end }}
|
||||
|
||||
{{ partial "article-link-card.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ if not $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
<section class="space-y-10 w-full">
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
{{ if $.Params.groupByYear | default ($.Site.Params.term.groupByYear | default true) }}
|
||||
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||
{{ .Key }}
|
||||
</h2>
|
||||
{{ end }}
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-link.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
<section class="mt-10 prose dark:prose-invert">
|
||||
<p class="py-8 border-t">
|
||||
<em>{{ i18n "list.no_articles" | emojify }}</em>
|
||||
</p>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination.html" . }}
|
||||
|
||||
{{ end }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{ $articleClasses := "flex flex-wrap article" }}
|
||||
{{ if .Site.Params.list.showCards }}
|
||||
{{ $articleClasses = delimit (slice $articleClasses "border border-neutral-200 dark:border-neutral-700 border-2 rounded-md") " " }}
|
||||
{{ $articleClasses = delimit (slice $articleClasses "border border-neutral-200 dark:border-neutral-700 border-2 rounded-md backdrop-blur") " " }}
|
||||
{{ else }}
|
||||
{{ $articleClasses = delimit (slice $articleClasses "") " " }}
|
||||
{{ end }}
|
||||
|
|
36
layouts/partials/article-meta-taxonomy.html
Normal file
36
layouts/partials/article-meta-taxonomy.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{/* Determine the correct context and scope */}}
|
||||
{{/* This allows for different logic depending on where the partial is called */}}
|
||||
{{ $context := . }}
|
||||
{{ $scope := default nil }}
|
||||
|
||||
{{ if (reflect.IsMap . ) }}
|
||||
{{ $context = .context }}
|
||||
{{ $scope = cond (not .scope) nil .scope }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $context }}
|
||||
{{ $meta := newScratch }}
|
||||
|
||||
{{/* Gather partials for this context */}}
|
||||
|
||||
{{ if (.Params.showViews | default (.Site.Params.taxonomy.showViews | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if (.Params.showLikes | default (.Site.Params.taxonomy.showLikes | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.taxonomy.showLikes | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div class="flex flex-row flex-wrap items-center">
|
||||
{{/* Output partials */}}
|
||||
{{ with ($meta.Get "partials") }}
|
||||
{{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
36
layouts/partials/article-meta-term.html
Normal file
36
layouts/partials/article-meta-term.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{/* Determine the correct context and scope */}}
|
||||
{{/* This allows for different logic depending on where the partial is called */}}
|
||||
{{ $context := . }}
|
||||
{{ $scope := default nil }}
|
||||
|
||||
{{ if (reflect.IsMap . ) }}
|
||||
{{ $context = .context }}
|
||||
{{ $scope = cond (not .scope) nil .scope }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $context }}
|
||||
{{ $meta := newScratch }}
|
||||
|
||||
{{/* Gather partials for this context */}}
|
||||
|
||||
{{ if (.Params.showViews | default (.Site.Params.term.showViews | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }}
|
||||
{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div class="flex flex-row flex-wrap items-center">
|
||||
{{/* Output partials */}}
|
||||
{{ with ($meta.Get "partials") }}
|
||||
{{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hugo-blowfish-theme",
|
||||
"version": "2.17.1",
|
||||
"version": "2.18.0",
|
||||
"description": "Blowfish theme for Hugo",
|
||||
"scripts": {
|
||||
"fullinstall": "npm run preinstall && npm install && npm run postinstall",
|
||||
|
|
Loading…
Reference in a new issue