mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-06-12 01:47:28 -05:00
Use indentation inside templating blocks for better readability
This commit is contained in:
@ -1,29 +1,28 @@
|
||||
{{ $hidecaption := index . "hidecaption" }}
|
||||
|
||||
{{ if index . "noborder" }}
|
||||
<figure>
|
||||
<figure>
|
||||
{{ else }}
|
||||
<figure class="border">
|
||||
<figure class="border">
|
||||
{{ end }}
|
||||
|
||||
{{ with index . "src" }}
|
||||
{{ $media := . }}
|
||||
{{ if eq .MediaType.MainType "image" }}
|
||||
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
||||
{{ else if eq .MediaType.MainType "video" }}
|
||||
<video controls>
|
||||
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ $media := . }}
|
||||
{{ if eq .MediaType.MainType "image" }}
|
||||
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
||||
{{ else if eq .MediaType.MainType "video" }}
|
||||
<video controls>
|
||||
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ if not $hidecaption }}
|
||||
{{ with $media.Title }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $hidecaption }}
|
||||
{{ with $media.Title }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</figure>
|
||||
|
@ -4,26 +4,26 @@
|
||||
{{ hugo.Generator }}
|
||||
|
||||
{{ with resources.Get "css/bobastyle.css" | fingerprint "sha512" }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ with resources.Get "css/syntax.css" | fingerprint "sha512" }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ with resources.Get "css/syntax-light.css" | fingerprint "sha512" }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.faviconICO }}
|
||||
<link rel="icon" type="image/x-icon" href="{{ . | absURL }}" />
|
||||
<link rel="icon" type="image/x-icon" href="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
{{ with .Site.Params.faviconPNG }}
|
||||
<link rel="icon" type="image/png" href="{{ . | absURL }}" />
|
||||
<link rel="icon" type="image/png" href="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsHome }}
|
||||
<title>{{ .Site.Title | plainify }}</title>
|
||||
<title>{{ .Site.Title | plainify }}</title>
|
||||
{{ else }}
|
||||
<title>{{ (print .Title " | " .Site.Title) | plainify }}</title>
|
||||
<title>{{ (print .Title " | " .Site.Title) | plainify }}</title>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "seo-tags/opengraph.html" . }}
|
||||
|
@ -1,19 +1,16 @@
|
||||
{{ with .Params.authors }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "user-circle" }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "user-circle" }}
|
||||
|
||||
{{ if index $.Site.Taxonomies "authors" }}
|
||||
|
||||
{{ $authors := slice }}
|
||||
{{ range . }}
|
||||
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
|
||||
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
|
||||
{{ end }}
|
||||
{{ delimit $authors ", " }}
|
||||
|
||||
{{ else }}
|
||||
{{ delimit . ", " }}
|
||||
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ if index $.Site.Taxonomies "authors" }}
|
||||
{{ $authors := slice }}
|
||||
{{ range . }}
|
||||
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
|
||||
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
|
||||
{{ end }}
|
||||
{{ delimit $authors ", " }}
|
||||
{{ else }}
|
||||
{{ delimit . ", " }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{ if ne .Site.Params.readingtime false }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ i18n "readingtime" .ReadingTime }}
|
||||
</span>
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ i18n "readingtime" .ReadingTime }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
@ -1,12 +1,11 @@
|
||||
{{ with (.GetTerms "series") }}
|
||||
{{ $series := slice }}
|
||||
{{ range . }}
|
||||
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $series := slice }}
|
||||
{{ range . }}
|
||||
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
|
||||
{{ end }}
|
||||
|
||||
<div class="series">
|
||||
{{ partial "icon.html" "files" }}
|
||||
{{ delimit $series ", " }}
|
||||
</div>
|
||||
<div class="series">
|
||||
{{ partial "icon.html" "files" }}
|
||||
{{ delimit $series ", " }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
@ -1,12 +1,11 @@
|
||||
{{ with (.GetTerms "tags") }}
|
||||
{{ $tags := slice }}
|
||||
{{ range . }}
|
||||
{{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $tags := slice }}
|
||||
{{ range . }}
|
||||
{{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
|
||||
{{ end }}
|
||||
|
||||
<div class="tags">
|
||||
{{ partial "icon.html" "tag" }}
|
||||
{{ delimit $tags ", " }}
|
||||
</div>
|
||||
<div class="tags">
|
||||
{{ partial "icon.html" "tag" }}
|
||||
{{ delimit $tags ", " }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{{ if .IsTranslated }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "world" }}
|
||||
{{ range .Translations }}
|
||||
<a href="{{ .Permalink }}">{{ .Language }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "world" }}
|
||||
{{ range .Translations }}
|
||||
<a href="{{ .Permalink }}">{{ .Language }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{{ if and .Site.Params.gitFileURL .File.Path }}
|
||||
<span class="post-meta-item">
|
||||
{{ with .Site.Params.gitFileIcon }}
|
||||
{{ partial "icon.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "icon.html" "file" }}
|
||||
{{ end }}
|
||||
<span class="post-meta-item">
|
||||
{{ with .Site.Params.gitFileIcon }}
|
||||
{{ partial "icon.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "icon.html" "file" }}
|
||||
{{ end }}
|
||||
|
||||
<a href="{{ printf "%s/content/%s" .Site.Params.gitFileURL .File.Path }}" target="_blank" rel="noopener">
|
||||
View source
|
||||
</a>
|
||||
</span>
|
||||
<a href="{{ printf "%s/content/%s" .Site.Params.gitFileURL .File.Path }}" target="_blank" rel="noopener">
|
||||
View source
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
@ -1,28 +1,28 @@
|
||||
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime .Site.Params.gitFileURL }}
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
|
||||
</time>
|
||||
</span>
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
|
||||
</time>
|
||||
</span>
|
||||
|
||||
{{/* TODO: make this be a tooltip */}}
|
||||
{{ if ne (time.Format "2006-01-02" .Lastmod) (time.Format "2006-01-02" .Date) }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "pencil" }}
|
||||
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Lastmod "Data" .Site.Data) }}
|
||||
</time>
|
||||
{{/* TODO: make this be a tooltip */}}
|
||||
{{ if ne (time.Format "2006-01-02" .Lastmod) (time.Format "2006-01-02" .Date) }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "pencil" }}
|
||||
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Lastmod "Data" .Site.Data) }}
|
||||
</time>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "post-meta-item/authors.html" . }}
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/viewsource.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ partial "post-meta-item/authors.html" . }}
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/viewsource.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime }}
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
|
||||
</time>
|
||||
</span>
|
||||
{{ end }}
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
|
||||
</time>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "post-meta-item/authors.html" . }}
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/series.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ partial "post-meta-item/authors.html" . }}
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/series.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
@ -4,24 +4,25 @@
|
||||
{{ $alt := index . "alt" }}
|
||||
|
||||
{{ if index . "border" }}
|
||||
<figure class="border">
|
||||
<figure class="border">
|
||||
{{ else }}
|
||||
<figure>
|
||||
<figure>
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $type "image" }}
|
||||
<img src="{{ $src }}" alt="{{ $alt }}" />
|
||||
<img src="{{ $src }}" alt="{{ $alt }}" />
|
||||
{{ else if eq $type "video" }}
|
||||
<video controls>
|
||||
<source src="{{ $src }}" alt="{{ $alt }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
<video controls>
|
||||
<source src="{{ $src }}" alt="{{ $alt }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ if not $hidecaption }}
|
||||
{{ with $alt }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ with $alt }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</figure>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<span class="rss-link">
|
||||
{{ with .OutputFormats.Get "rss" }}
|
||||
<a href="{{ .Permalink }}" target="_blank" rel="noopener">{{ partial "icon.html" "rss-feed" }}</a>
|
||||
<a href="{{ .Permalink }}" target="_blank" rel="noopener">{{ partial "icon.html" "rss-feed" }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
|
@ -1,9 +1,7 @@
|
||||
{{ with .Params.authors }}
|
||||
<meta name="author" content="{{ delimit . ", " }}">
|
||||
|
||||
<meta name="author" content="{{ delimit . ", " }}">
|
||||
|
||||
{{ range . }}
|
||||
<meta property="article:author" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
{{ range . }}
|
||||
<meta property="article:author" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -5,49 +5,46 @@
|
||||
<div class="topbar">
|
||||
<nav class="navbar">
|
||||
{{ with .Site.Home }}
|
||||
<a class="navbar-item{{ if $.IsHome }} active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
|
||||
<a class="navbar-item{{ if $.IsHome }} active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
|
||||
{{ end }}
|
||||
|
||||
{{ range .Site.Menus.main }}
|
||||
|
||||
{{ $isActive := false }}
|
||||
{{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }}
|
||||
{{ $isActive = true }}
|
||||
{{ end }}
|
||||
|
||||
<a class="navbar-item{{ if $isActive }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
||||
|
||||
{{ $isActive := false }}
|
||||
{{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }}
|
||||
{{ $isActive = true }}
|
||||
{{ end }}
|
||||
<a class="navbar-item{{ if $isActive }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
<details class="langpicker">
|
||||
<summary>
|
||||
{{- partial "icon.html" "world" -}}
|
||||
</summary>
|
||||
<ul class="languages">
|
||||
{{ range .AllTranslations }}
|
||||
<li>
|
||||
<a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<details class="langpicker">
|
||||
<summary>
|
||||
{{- partial "icon.html" "world" -}}
|
||||
</summary>
|
||||
<ul class="languages">
|
||||
{{ range .AllTranslations }}
|
||||
<li>
|
||||
<a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
{{ $site_translations := slice }}
|
||||
{{ range .Site.Languages }}
|
||||
{{ $site_translations = $site_translations | append .LanguageName }}
|
||||
{{ end }}
|
||||
{{ $site_translations := slice }}
|
||||
{{ range .Site.Languages }}
|
||||
{{ $site_translations = $site_translations | append .LanguageName }}
|
||||
{{ end }}
|
||||
|
||||
{{ $translation_codes := slice }}
|
||||
{{ range .AllTranslations }}
|
||||
{{ $translation_codes = $translation_codes | append .Language }}
|
||||
{{ end }}
|
||||
{{ $translation_codes := slice }}
|
||||
{{ range .AllTranslations }}
|
||||
{{ $translation_codes = $translation_codes | append .Language }}
|
||||
{{ end }}
|
||||
|
||||
{{ range (.Site.Languages | complement $translation_codes) }}
|
||||
<li>
|
||||
<a class="langpicker-item unavailable">{{ .LanguageName }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</details>
|
||||
{{ range (.Site.Languages | complement $translation_codes) }}
|
||||
<li>
|
||||
<a class="langpicker-item unavailable">{{ .LanguageName }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</details>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user