Merge pull request #321 from nunocoracao/311-term-add-card-view

Term add card view
This commit is contained in:
Nuno Coração 2022-12-12 23:27:22 +00:00 committed by GitHub
commit adec3dae1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 37 deletions

View file

@ -101,7 +101,6 @@ enableCodeCopy = true
#showViews = false
#showLikes = false
#showTableOfContents = true
#showCards = false
#groupByYear = false
#cardViewScreenWidth = false
#cardView = false

View file

@ -100,9 +100,8 @@ defaultBackgroundImage = "/img/iceland.jpg"
showViews = true
showLikes = true
showTableOfContents = true
showCards = true
groupByYear = false
cardView = true
cardView = false
cardViewScreenWidth = false

View file

@ -60,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">
@ -131,5 +129,4 @@
{{ partial "pagination.html" . }}
{{ end }}
{{ end }}

View file

@ -27,15 +27,15 @@
<div class="min-w-0 min-h-0 max-w-prose">
{{ .Content | emojify }}
</div>
<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>
{{ 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">

View file

@ -27,27 +27,100 @@
<div class="min-w-0 min-h-0 max-w-prose">
{{ .Content | emojify }}
</div>
<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>
{{ 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 }}