Commit e1bbbb00 authored by Kaushal Modi's avatar Kaushal Modi

Use the new Go Templ variable re-assignment operator = (go 1.11)

Ref: https://github.com/golang/go/commit/28c1ad9d35f27b3b57afff4ee78faac746a8ed0a
parent 85dd512d
<!-- https://indieauth.com/setup -->
{{ printf `<!-- rel="me" links for IndieAuth -->` | safeHTML }}
{{ $.Scratch.Set "__relme_exists" false }}
{{ $relme_exists := false }}
{{ range $.Site.Params.social -}}
{{- if .relme -}}
{{- printf `<link href="%s" rel="me">` .link | safeHTML -}}
{{ $.Scratch.Set "__relme_exists" true }}
{{ $relme_exists = true }}
{{- end -}}
{{- end }}
{{ if ($.Scratch.Get "__relme_exists") }}
{{ if $relme_exists }}
<!-- https://www.amitgawande.com/indiewebify-hugo-website/ -->
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
<!-- Token Endpoint: https://tokens.indieauth.com/ -->
......
......@@ -11,6 +11,8 @@
[syndication]
twitter = 975860854573936640
-->
{{ $syndication_class := "" }}
{{ $syndication_link := "" }}
{{ with .Params.syndication }}
{{ range $key, $val := . }}
{{ $val_is_string := (eq "string" (printf "%T" $val)) }}
......@@ -18,25 +20,25 @@
{{ if (eq $key (.name | lower)) }}
{{ if (eq $key "twitter") }}
{{ if (and $val_is_string (not (eq $val "")) (not (eq $val "0"))) }}
{{ $.Scratch.Set "__syndication_link" (printf "%sstatus/%s" .link $val) }}
{{ $.Scratch.Set "__syndication_class" (.name | lower) }}
{{ $syndication_link = (printf "%sstatus/%s" .link $val) }}
{{ $syndication_class = (.name | lower) }}
{{ else if (gt $val 0) }}
{{ $.Scratch.Set "__syndication_link" (printf "%sstatus/%d" .link $val) }}
{{ $.Scratch.Set "__syndication_class" (.name | lower) }}
{{ $syndication_link = (printf "%sstatus/%d" .link $val) }}
{{ $syndication_class = (.name | lower) }}
{{ end }}
{{ else if (eq $key "mastodon") }}
{{ if (and $val_is_string (not (eq $val "")) (not (eq $val "0"))) }}
{{ $.Scratch.Set "__syndication_link" (printf "%s/%s" .link $val) }}
{{ $.Scratch.Set "__syndication_class" (.name | lower) }}
{{ $syndication_link = (printf "%s/%s" .link $val) }}
{{ $syndication_class = (.name | lower) }}
{{ else if (gt $val 0) }}
{{ $.Scratch.Set "__syndication_link" (printf "%s/%d" .link $val) }}
{{ $.Scratch.Set "__syndication_class" (.name | lower) }}
{{ $syndication_link = (printf "%s/%d" .link $val) }}
{{ $syndication_class = (.name | lower) }}
{{ end }}
{{ end }}
{{ if ($.Scratch.Get "__syndication_class") }}
{{ if (not (eq "" $syndication_class)) }}
<a rel="syndication"
class="u-syndication {{ $.Scratch.Get "__syndication_class" }} no-text-decoration"
href="{{ $.Scratch.Get "__syndication_link" }}"
href="{{ $syndication_link }}"
title="This post was syndicated to {{ .name }}">
<i class="fab fa-{{ if .icon }}{{ .icon }}{{ else }}{{ lower .name }}{{ end }}"></i>
</a>&nbsp;
......
......@@ -5,7 +5,7 @@ description = "A Hugo theme made solely for https://scripter.co"
homepage = "https://scripter.co"
tags = ["refined"]
features = ["Atom Feed", "JF2 Feed", "Fuse.js Search"]
min_version = "0.45"
min_version = "0.48-DEV"
[author]
name = "Kaushal Modi"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment