Corrections pour script minify

This commit is contained in:
HUC Stéphane 2021-09-16 12:43:16 +02:00
parent 0c57da5ade
commit 31fc252782
Signed by: hucste
GPG Key ID: C4ED64222D9B037F
3 changed files with 98 additions and 6 deletions

View File

@ -504,6 +504,9 @@ uglyURLs = false
# Translate the month? (valid for title)
i18nMonth = true
# French format date
frenchFormat = true
frDateFormat = "02/01/2006"
######################################
# Taxonomy List Page

View File

@ -12,11 +12,11 @@ set -e
#
# Github:
#
# Date: 2021/05/24
# Date: 2021/09/16 12:40
#
###
#
# USE: ./deploy
# USE: ./deploy.bash
#
###
#
@ -24,6 +24,7 @@ set -e
# - brotli : compression format .br
# - sshfs + rsync
# - lftp (solution de repli)
# - java : pour le script minify
#
###
@ -39,8 +40,9 @@ port=22
dir_dist="/var/www/htdocs/www.openbsd.fr.eu.org/"
dir_local="$ROOT/public/"
dir_mount="$HOME/servers/${host}/"
dir_tools="$ROOT/scripts_nohugo/outils/"
email="red+bckp-ebnh@huc.fr.eu.org"
email="red+bckp-obsd4a@huc.fr.eu.org"
rsync_xclud="--exclude=gopher --exclude=gemini"
rsync_opts="--human-readable --progress --stats "
@ -166,10 +168,11 @@ main() {
_git
fi
if confirm "Do you want to minimize images? "; then
if confirm "Do you want to minify CC, JS files? "; then
_minify
sleep 1
fi
if confirm "Do you want to convert images to Avif, Webp formats? "; then
_webp
sleep 1
fi
@ -198,7 +201,7 @@ main() {
# call minify script
_minify() {
/home/zou/Projets/outils/minify.bash "$ROOT/static"
"${dir_tools}"/minify.bash "$ROOT/static"
}
# mount remoted fs with sshfs

View File

@ -0,0 +1,86 @@
{{ $ := index . "$" }}{{- $dateFormat := "2006-01-02T15:04:05-07:00" -}}
{{ $isHome := .isHome }}{{ if $.Site.Params.frenchFormat }}{{ $dateFormat = $.Site.Params.frDateFormat }}{{ end }}
<div class="post-meta">
{{ if and $.Site.Params.displayPublishedDate (not $.PublishDate.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.publishedDateIcon "class" "post-meta-icon") }}
<time datetime="{{ $.PublishDate.Format $dateFormat }}" class="post-meta-item published dt-published">{{ $icon }}&nbsp;{{ $.PublishDate.Format $.Site.Params.postMetaDateFormat }}</time>
{{ end }}
{{ if and $.Site.Params.displayModifiedDate (not $.Lastmod.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.modifiedDateIcon "class" "post-meta-icon") }}
<time datetime="{{ $.Lastmod.Format $dateFormat }}" class="post-meta-item modified dt-updated">{{ $icon }}&nbsp;{{ $.Lastmod.Format $.Site.Params.postMetaDateFormat }}</time>
{{ end }}
{{ if and $.Site.Params.displayExpiredDate (not $.ExpiryDate.IsZero) }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.expiredDateIcon "class" "post-meta-icon") }}
<time datetime="{{ $.ExpiryDate.Format $dateFormat }}" class="post-meta-item expired">{{ $icon }}&nbsp;{{ $.ExpiryDate.Format $.Site.Params.postMetaDateFormat }}</time>
{{ end }}
{{ if $.Site.Params.displayCategory }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.categoryIcon "class" "post-meta-icon") }}
{{ if and (eq $.Site.Params.categoryBy "sections") (in $.Site.Params.mainSections $.Section) }}
{{ $sections := split (strings.TrimSuffix "/" ($.File.Dir | default $.Section)) "/" }}
{{ with $sections }}
{{ $.Scratch.Delete "sectionsDirMeta" }}
{{ $.Scratch.Delete "sectionsMeta" }}
{{ $.Scratch.Set "index" 0 }}
{{ range $sections }}
{{ $section := . }}
{{ $.Scratch.Add "sectionsDirMeta" (printf `/%s` $section) }}
{{ with $.Site.GetPage ($.Scratch.Get "sectionsDirMeta") }}
{{ if (eq .Kind "section") }}
{{ $.Scratch.SetInMap "sectionsMeta" (printf `%s/%s` (string ($.Scratch.Get "index")) .RelPermalink) (.LinkTitle | default $section) }}
{{ $.Scratch.Set "index" (add ($.Scratch.Get "index") 1) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ $sections := $.Scratch.Get "sectionsMeta" }}
{{ with $sections }}
<span class="post-meta-item category">
{{- $icon -}}&nbsp;
{{- range $link, $title := $sections -}}
{{- $index := $link | replaceRE `(\d+)/.+` `$1` | int -}}
{{- if ne $index 0 }}
{{- $.Site.Params.categoryDelimiter | default "/" -}}
{{- end -}}
<a href="{{- $link | replaceRE `\d+/(.+)` `$1` -}}" class="category-link p-category">
{{- $title -}}
</a>
{{- end -}}
</span>
{{ end }}
{{ end }}
{{ if eq $.Site.Params.categoryBy "categories" }}
{{ with $.Params.categories }}
<span class="post-meta-item category">
{{- $icon -}}&nbsp;
{{- range $index, $category := . -}}
{{- if ne $index 0 -}}
{{- $.Site.Params.categoryDelimiter | default "/" -}}
{{- end -}}
<!-- Work-around for https://github.com/gohugoio/hugo/issues/6546 -->
{{- $path := (urls.Parse ($category | urlize)).Path -}}
{{- with $.Site.GetPage (printf `/categories/%s` $path) -}}
<a href="{{- .RelPermalink -}}" class="category-link p-category">
{{- .LinkTitle | default $path -}}
</a>
{{- end -}}
{{- end -}}
</span>
{{ end }}
{{ end }}
{{ end }}
{{ if $.Site.Params.displayWordCount }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.wordCountIcon "class" "post-meta-icon") }}
<span class="post-meta-item wordcount">{{ $icon }}&nbsp;{{ $.WordCount }}</span>
{{ end }}
{{ if $.Site.Params.displayReadingTime }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.readingTimeIcon "class" "post-meta-icon") }}
<span class="post-meta-item reading-time">{{ $icon }}&nbsp;{{ $.ReadingTime }}&nbsp;{{ i18n "minute" $.ReadingTime }}</span>
{{ end }}
{{ if and $.Site.Params.displayBusuanziPagePV (eq hugo.Environment "production") }}
{{ if not $isHome }}
{{ $icon := partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.busuanziPagePVIcon "class" "post-meta-icon") }}
<span class="post-meta-item busuanzi-page-pv" id="busuanzi_container_page_pv">{{ $icon }}&nbsp;<span id="busuanzi_value_page_pv"></span></span>
{{ end }}
{{ end }}
{{ partial "custom/post-meta.html" $ }}
</div>