Merge branch 'main' into main

This commit is contained in:
Nuno Coração
2022-10-28 18:34:13 +01:00
committed by GitHub
55 changed files with 362 additions and 133 deletions

View File

@@ -1,3 +1,2 @@
<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}"{{ end }} {{ if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}>
{{ .Text | safeHTML }}
</a>
{{ .Text | safeHTML }}</a>

View File

@@ -25,7 +25,7 @@
</div>
</section>
{{ if gt .Pages 0 }}
<section class="space-y-10 max-w-prose">
<section class="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">

View File

@@ -2,11 +2,11 @@
<article>
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
{{ $heroStyle := print "partials/hero/" .Site.Params.article.heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ end }}
{{ if templates.Exists $heroStyle }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ end }}
{{- end -}}
<header id="single_header" class="mt-5 max-w-prose">
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
@@ -21,13 +21,15 @@
</header>
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
{{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in
.TableOfContents "<ul") }} <div class="order-first px-0 lg:order-last lg:max-w-xs ltr:lg:pl-8 rtl:lg:pr-8">
.TableOfContents "<ul") }}
<div class="order-first sm:max-w-prose lg:ml-auto px-0 lg:order-last lg:max-w-xs ltr:lg:pl-8 rtl:lg:pr-8">
<div class="toc ltr:pl-5 rtl:pr-5 print:hidden lg:sticky lg:top-10">
{{ partial "toc.html" . }}
</div>
</div>
{{ end }}
<div class="min-w-0 min-h-0 max-w-prose">
{{ partial "series.html" . }}
{{ .Content | emojify }}
</div>
<script>
@@ -146,10 +148,15 @@
var header = document.getElementById("single_header")
var style = getComputedStyle(header);
var margin = '-'+ (parseInt(style.height) + parseInt(style.marginTop) + parseInt(style.marginBottom) + 20) + 'px'
var hero = document.getElementById('hero')
if(hero)
if (hero) {
var margin = '-' + (parseInt(style.height) + parseInt(style.marginTop) + parseInt(style.marginBottom) + 20) + 'px'
var height = (-parseInt(margin) + parseInt(getComputedStyle(hero).height)) + "px"
console.log(height)
hero.style["margin-bottom"] = margin;
hero.style["height"] = height;
}
</script>
</section>
<footer class="pt-8 max-w-prose print:hidden">
@@ -165,9 +172,9 @@
{{ $taxonomyLink := 0 }}
{{ range $taxonomyname, $taxonomy := $taxonomies }}
{{ if (eq $taxonomyname $author) }}
{{ $taxonomyLink = delimit (slice $baseURL "authors/" $author) "" }}
{{ end }}
{{ if (eq $taxonomyname $author) }}
{{ $taxonomyLink = delimit (slice $baseURL "authors/" $author) "" }}
{{ end }}
{{ end }}
{{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }}

View File

@@ -12,7 +12,7 @@
</div>
</section>
{{ end }}
<section class="mt-5 space-y-10 max-w-prose">
<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">

View File

@@ -64,7 +64,7 @@
{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }}
<div class="flex flex-row flex-wrap items-center">
{{ range $taxonomy, $terms := .Site.Taxonomies }}
{{ if not (eq $taxonomy "authors")}}
{{ if and (not (eq $taxonomy "authors")) (not (eq $taxonomy "series"))}}
{{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}
{{ range $context.GetTerms $taxonomy }}
<span style="margin-top:0.5rem" class="mr-2" onclick="window.open({{ .RelPermalink }});">

View File

@@ -43,11 +43,13 @@
</div>
<script>
{{ if not .Site.Params.disableImageZoom | default true }}
mediumZoom(document.querySelectorAll("img:not(.nozoom)"), {
margin: 24,
background: 'rgba(0,0,0,0.5)',
scrollOffset: 0,
})
{{ end }}
</script>
{{ $jsProcess := resources.Get "js/process.js" }}
{{ $jsProcess = $jsProcess | resources.Minify | resources.Fingerprint "sha512" }}

View File

@@ -3,7 +3,7 @@
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ with .Resize "1200x" }}
<div id="hero" class="relative h-[45vh] single_hero_background nozoom" style="background-image:url({{ .RelPermalink }});">
<div id="hero" class="relative h-[300px] single_hero_background nozoom" style="background-image:url({{ .RelPermalink }});">
<div class="hero_gradient bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"></div>
</div>
{{ end }}

View File

@@ -4,15 +4,20 @@
<div class="mx-auto max-w-7xl p-0">
<div class="relative sm:overflow-hidden">
<div class="absolute inset-0">
<img class="h-full w-full object-cover m-0 nozoom" src="{{ .Site.Params.homepage.homepageImage }}">
{{ with .Site.Params.homepage.homepageImage }}
{{ $homepageImage := resources.Get . }}
{{ if $homepageImage }}
<img class="h-full w-full object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}">
<div
class="absolute inset-0 bg-gradient-to-t from-neutral-100 dark:from-neutral-800 to-transparent dark:to-neutral-300 mix-blend-normal dark:mix-blend-multiply">
</div>
<div
class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div>
{{ end }}
{{ end }}
</div>
<div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center">
<div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center justify-center text-center">
{{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}

View File

@@ -14,8 +14,13 @@
</div>
<div class="mt-6 sm:mt-16 lg:mt-0">
<div class="-mr-48 pl-4 sm:pl-6 md:-mr-16 lg:relative lg:m-0 lg:h-full lg:px-0">
{{ with .Site.Params.homepage.homepageImage }}
{{ $homepageImage := resources.Get . }}
{{ if $homepageImage }}
<img class="w-full rounded-xl shadow-xl lg:absolute lg:left-0 lg:h-full lg:w-auto lg:max-w-none"
src="{{ .Site.Params.homepage.homepageImage }}">
src="{{ $homepageImage.RelPermalink }}">
{{ end }}
{{ end }}
</div>
</div>
</div>

View File

@@ -4,12 +4,17 @@
<div class="mx-auto max-w-7xl p-0">
<div class="relative shadow-xl sm:overflow-hidden rounded-2xl">
<div class="absolute inset-0">
<img class="h-full w-full object-cover m-0 nozoom" src="{{ .Site.Params.homepage.homepageImage }}">
{{ with .Site.Params.homepage.homepageImage }}
{{ $homepageImage := resources.Get . }}
{{ if $homepageImage }}
<img class="h-full w-full object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}">
<div
class="absolute inset-0 bg-gradient-to-r from-primary-500 to-secondary-700 dark:from-primary-600 dark:to-secondary-800 mix-blend-multiply">
</div>
{{ end }}
{{ end }}
</div>
<div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center">
<div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center justify-center text-center">
{{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }}
{{ if $authorImage }}

View File

@@ -1,4 +1,5 @@
<span>
<span id="likes_{{ .File.Path }}" title="likes">{{- i18n "article.likes" 0 | markdownify | emojify -}}</span>
<span id="likes_{{ .File.Path }}" title="likes">0</span>
<span>{{ partial "icon.html" "heart" }}</span>
</span>
{{- /* Trim EOF */ -}}

View File

@@ -1,4 +1,5 @@
<span id="views_{{ .File.Path }}" title="views">
{{- i18n "article.views" 0 | markdownify | emojify -}}
<span>
<span id="views_{{ .File.Path }}" title="views">0</span>
<span>{{ partial "icon.html" "eye" }}</span>
</span>
{{- /* Trim EOF */ -}}

View File

@@ -0,0 +1,24 @@
{{ if .Params.series }}
<details style="margin-left:0px" class="mt-2 mb-5 overflow-hidden rounded-lg ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5" {{ if .Params.seriesOpened | default (.Site.Params.article.seriesOpened | default false) }} open {{ end }}>
<summary
class="py-1 text-lg font-semibold cursor-pointer bg-primary-200 text-neutral-800 ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 dark:bg-primary-800 dark:text-neutral-100">
{{ index .Params.series 0 }} - This article is part of a series.
</summary>
{{ range $post := sort (index .Site.Taxonomies.series (index .Params.series 0 | urlize)) "Params.series_order" }}
{{ if eq $post.Permalink $.Page.Permalink }}
<div
class="py-1 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600">
Part {{ $post.Params.series_order }}: This Article
</div>
{{ else }}
<div
class="py-1 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600">
<a href="{{$post.Permalink}}">
Part {{ $post.Params.series_order }}: {{ $post.Params.title}}
</a>
</div>
{{end}}
{{end}}
</details>
{{end}}