diff --git a/.gitignore b/.gitignore index 6b28dc7..c4234b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ public resources themes +assets/img static/img .hugo_build.lock \ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 90c0fab..b9d1a19 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -18,10 +18,10 @@ {{- if $refPage -}} {{ .Params.title }} + src="{{ $image.RelPermalink }}" alt="{{ $refPage.Title }}"> {{- else -}} {{ .Params.title }} + src="{{ $image.RelPermalink }}" alt="{{ .Title }}"> {{- end -}} {{- else if .Params.teaser -}}
@@ -57,46 +57,46 @@
{{- end }} - {{ if not .Site.Params.hideParentArticles -}} + {{- if not .Site.Params.hideParentArticles -}} {{- $related := where .Site.RegularPages "Params.pageid" "in" .Params.parents -}} {{- partial "card-related" (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} - {{- end }} + {{- end -}} - {{ if and (not .Site.Params.hideChildArticles) + {{- if and (not .Site.Params.hideChildArticles) (ne .Site.Params.showChildArticles "sidebar") -}} {{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} {{- partial "card-related" (dict "related" $related "header" (i18n "child-articles") "id" "children") -}} - {{- end }} + {{- end -}} - {{ if not .Site.Params.hideRelatedArticles -}} + {{- if not .Site.Params.hideRelatedArticles -}} {{- $related := .Site.RegularPages.RelatedIndices . "topics" -}} {{- partial "card-related" (dict "related" $related "header" (i18n "related-articles") "id" "related") -}} - {{- end }} + {{- end -}} - {{ if not .Site.Params.hideSiblingArticles -}} + {{- if not .Site.Params.hideSiblingArticles -}} {{- $related := .Site.RegularPages.RelatedIndices . "parents" -}} {{- partial "card-related" (dict "related" $related "header" (i18n "sibling-articles") "id" "siblings") -}} - {{- end }} + {{- end -}} - {{ if not .Site.Params.hideSectionArticles -}} + {{- if not .Site.Params.hideSectionArticles -}} {{- $section := or .Section "posts" -}} {{- $header := or (i18n (printf "articles-in-%s" $section)) (i18n "articles-in-section") -}} {{- $related := first 20 (where .Site.RegularPages "Section" $section) -}} {{- partial "card-related" (dict "related" $related "header" $header "id" "articles-in-section") -}} - {{- end }} + {{- end -}} - {{ if not .Site.Params.hideBacklinks -}} + {{- if not .Site.Params.hideBacklinks -}} {{- $related := .Scratch.Get "backlinks" -}} {{- partial "card-related" (dict "related" $related "header" (i18n "backlinks") "id" "backlinks") -}} - {{- end }} + {{- end -}} - {{ if .Params.showtoc -}} + {{- if .Params.showtoc -}}

{{i18n "toc"}}

@@ -105,6 +105,6 @@ {{ .TableOfContents }}
- {{ end -}} + {{- end -}} diff --git a/layouts/shortcodes/iimg.html b/layouts/shortcodes/iimg.html new file mode 100644 index 0000000..c714d8b --- /dev/null +++ b/layouts/shortcodes/iimg.html @@ -0,0 +1,27 @@ +

+ {{- $img := or (.Get "src") (.Get "img") -}} + {{- $ref := .Get "ref" -}} + {{- $scale := .Get "scale" -}} + {{- $alt := or (.Get "alt") (.Get "title") -}} + {{- $refImg := "" -}} + {{- $refPage := "" -}} + {{- if $ref -}} + {{- range where .Site.RegularPages "Params.pageid" "eq" $ref -}} + {{- $refImg = .Params.img -}} + {{- $refPage = . -}} + {{- end -}} + {{- end -}} + {{- if not $img -}} + {{- $img = $refImg -}} + {{- end -}} + {{- $image := (resources.Get (printf "img/%s" $img)) -}} + {{- if $scale -}} + {{- $image = $image.Resize $scale -}} + {{- end -}} + {{- if $refPage -}} + {{ or $alt $refPage.Title }} + {{- else -}} + {{ $alt }} + {{- end -}} +

\ No newline at end of file diff --git a/layouts/shortcodes/ilink.html b/layouts/shortcodes/ilink.html index 61a7675..45ee63c 100644 --- a/layouts/shortcodes/ilink.html +++ b/layouts/shortcodes/ilink.html @@ -1,7 +1,7 @@ -{{- $this := $.Page -}} {{- $pid := or (.Get "pid") (.Get "page") -}} -{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} {{- $frag := or (.Get "id") (.Get "anchor") -}} +{{- $this := $.Page -}} +{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} {{- $fragsep := cond (eq $frag "") "" "#" -}} {{- $inner := .Inner -}} {{- range $pages -}}