diff options
-rw-r--r-- | config.json | 2 | ||||
-rw-r--r-- | config.toml | 2 | ||||
-rw-r--r-- | config.yaml | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/summary.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/partials/card-meta.html | 63 | ||||
-rw-r--r-- | themes/default/layouts/partials/feeds-generate.html | 32 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-date-time.html | 13 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-expiry-date.html (renamed from themes/default/layouts/partials/expiry-date.html) | 0 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-handle.html (renamed from themes/default/layouts/partials/handle.html) | 8 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-read-time.html (renamed from themes/default/layouts/partials/read-time.html) | 0 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-source.html | 12 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-word-count.html (renamed from themes/default/layouts/partials/word-count.html) | 0 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta.html | 64 |
13 files changed, 120 insertions, 80 deletions
diff --git a/config.json b/config.json index f47a7b1..3e6db0c 100644 --- a/config.json +++ b/config.json @@ -288,7 +288,7 @@ "target": "static/data" }, { - "source": "public/data/generators/content", + "source": "public/data/generates/content", "target": "content" } ] diff --git a/config.toml b/config.toml index c91441a..2375ee2 100644 --- a/config.toml +++ b/config.toml @@ -217,5 +217,5 @@ enableRobotsTXT = true target = "static/data" [[module.mounts]] - source = "public/data/generators/content" + source = "public/data/generates/content" target = "content" diff --git a/config.yaml b/config.yaml index 87f210d..a71f1d5 100644 --- a/config.yaml +++ b/config.yaml @@ -191,5 +191,5 @@ module: target: static/sources/files - source: data target: static/data - - source: public/data/generators/content + - source: public/data/generates/content target: content diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html index ef4fe11..430ec86 100644 --- a/themes/default/layouts/_default/summary.html +++ b/themes/default/layouts/_default/summary.html @@ -6,7 +6,7 @@ </micro-thumbnail> <micro-content> <micro-metadata> - {{ partial "meta.html" . }} + {{ partial "card-meta.html" . }} </micro-metadata> {{ if .Params.nsfw }} <micro-nsfw> diff --git a/themes/default/layouts/partials/card-meta.html b/themes/default/layouts/partials/card-meta.html new file mode 100644 index 0000000..23219e7 --- /dev/null +++ b/themes/default/layouts/partials/card-meta.html @@ -0,0 +1,63 @@ +<micro-thumbnail hidden> + {{ partial "profile-picture.html" . }} +</micro-thumbnail> + +<section> + {{ if or .Weight .Params.Liked }} + <anchored-entry> + + {{ if .Weight }} + <anchored-pinned> + {{ safeHTML (readFile "static/icons/tabler/pinned.svg") }} + </anchored-pinned> + <span>Pinned</span> + {{ end }} + + {{ if .Params.Liked }} + <anchored-liked> + {{ safeHTML (readFile "static/icons/feather/heart.svg") }} + </anchored-liked> + <span>Liked</span> + {{ end }} + + </anchored-entry> + {{ end }} + + <h2> + <b> + {{- with .Params.feedName -}} + {{ . }} + {{- else -}} + {{ partial "author-name.html" . }} + {{- end -}} + </b> + </h2> + + · {{ partial "meta-handle.html" . }} + + {{ if .Draft }} + · <draft-label><em>Draft</em></draft-label> + {{ end }} + + · {{- partial "meta-read-time.html" . -}} + + · {{- partial "meta-word-count.html" . -}} + + {{ if .Params.Unlisted }} + · <unlisted-entry title="This message is off the record"> + {{ safeHTML (readFile "static/icons/feather/eye-off.svg") }} + <span>unlisted</span></unlisted-entry> + {{ end }} + + · {{- partial "meta-date-time.html" . -}} + + {{- if .ExpiryDate -}} + · {{- partial "meta-expiry-date.html" . -}} + {{- end -}} + + · <cite><a title="#{{ partial "card-id.html" . }}" href="#{{ partial "card-id.html" . }}">#id</a></cite> + + {{ if not .ExpiryDate }} + · {{ partial "meta-source.html" . -}} + {{- end -}} +</section> diff --git a/themes/default/layouts/partials/feeds-generate.html b/themes/default/layouts/partials/feeds-generate.html index cec17d8..24ed9a8 100644 --- a/themes/default/layouts/partials/feeds-generate.html +++ b/themes/default/layouts/partials/feeds-generate.html @@ -81,16 +81,18 @@ {{ $feeds = $feeds | append (dict - "FeedTitle" ($title | plainify | htmlUnescape) - "FeedLink" ($link | plainify | htmlUnescape) - "FeedDescription" (delimit ($description | plainify | htmlUnescape | findRE "^([^.|:|?|!]+)") " ") "FeedContent" ($content | plainify | htmlUnescape) - "FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape) - "FeedSourceLink" ($sourceLink | plainify | htmlUnescape) - "FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape) "FeedDate" ($date | plainify | htmlUnescape | time.Format "January 2, 2006") "FeedDateTime" ($dateTime | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z") "FeedDateTitle" ($dateTitle | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST") + "FeedDescription" (delimit ($description | plainify | htmlUnescape | findRE "^([^.|:|?|!]+)") " ") + "FeedLink" ($link | plainify | htmlUnescape) + "FeedName" (delimit ((delimit (first 3 (split ($sourceTitle | plainify | htmlUnescape) " ")) " ") | findRE "^([^.|:|?|!]+)") " " | replaceRE "[^a-zA-Z ]" "") + "FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape) + "FeedSourceLink" ($sourceLink | plainify | htmlUnescape) + "FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape) + "FeedTitle" ($title | plainify | htmlUnescape) + "FeedSourceDomain" ($sourceLink | plainify | htmlUnescape | replaceRE "^https?://([^/]+).*" "$1") ) }} @@ -100,13 +102,19 @@ {{ range $feeds }} {{ $template := resources.Get "templates/markdown.yaml" }} + {{ $name := urlize (replace .FeedTitle "/" "-") }} + {{ $path := print "/data/generates/content/" $author.user "/feeds/" $name ".md" }} {{ $markdown := resources.ExecuteAsTemplate - (print "/data/generators/content/" $author.user "/feeds/" (urlize (replace .FeedTitle "/" "-")) ".md") + $path (dict - "content" (print (or .FeedDescription .FeedTitle) ".") - "tags" "[rss]" - "rss" true - "date" .FeedDateTime + "content" (print (or .FeedDescription .FeedTitle) ".") + "date" .FeedDateTime + "tags" "[rss]" + "feedName" .FeedName + "feedDomain" .FeedSourceDomain + "feedLink" .FeedLink + "feedSelf" (print $author.user "/feeds/" $name "/") + "feedRaw" (strings.TrimLeft "/" $path) ) $template }} @@ -116,7 +124,7 @@ <web-ring> <h1>Web Ring</h1> <aside> - {{ range first 3 (sort $feeds "FeedDateTime" "desc") }} + {{ range first 4 (sort $feeds "FeedDateTime" "desc") }} <web-ring-item> <header> <a diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-date-time.html new file mode 100644 index 0000000..2c73bc2 --- /dev/null +++ b/themes/default/layouts/partials/meta-date-time.html @@ -0,0 +1,13 @@ +{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}} + +{{- with .Params.feedSelf -}} +<a href="{{ $.Site.BaseURL }}/{{ . }}"> +{{ else }} +<a href="{{ .Site.BaseURL }}/{{ $author.user }}/messages/{{ path.Base .Permalink }}#{{ partial "card-id.html" . }}"> +{{ end }} + <time + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + title="{{ .Date | time.Format "Monday, January 2, 2006 at 15:04:05 MST" }}"> + {{ (.Date.Local | time.Format "3:04 PM Jan 2 2006") }} + </time> +</a> diff --git a/themes/default/layouts/partials/expiry-date.html b/themes/default/layouts/partials/meta-expiry-date.html index bf111f9..bf111f9 100644 --- a/themes/default/layouts/partials/expiry-date.html +++ b/themes/default/layouts/partials/meta-expiry-date.html diff --git a/themes/default/layouts/partials/handle.html b/themes/default/layouts/partials/meta-handle.html index 2319ba4..b9da43b 100644 --- a/themes/default/layouts/partials/handle.html +++ b/themes/default/layouts/partials/meta-handle.html @@ -1,5 +1,13 @@ +{{- with .Params.feedDomain -}} +<a + title="{{ . }}" + href="http://{{ . }}"> + @{{ . }} +</a> +{{- else -}} <a title="{{ partial "author-user.html" . }}@{{ replaceRE "^https?://([^/]+).*" "$1" .Site.BaseURL }}" href="{{ .Site.BaseURL }}/{{ partial "author-user.html" . }}"> @{{ partial "author-user.html" . }} </a> +{{- end -}} diff --git a/themes/default/layouts/partials/read-time.html b/themes/default/layouts/partials/meta-read-time.html index 7222fc6..7222fc6 100644 --- a/themes/default/layouts/partials/read-time.html +++ b/themes/default/layouts/partials/meta-read-time.html diff --git a/themes/default/layouts/partials/meta-source.html b/themes/default/layouts/partials/meta-source.html new file mode 100644 index 0000000..a2099e2 --- /dev/null +++ b/themes/default/layouts/partials/meta-source.html @@ -0,0 +1,12 @@ +{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}} +{{- $source := print $author.user "/messages/" .File.LogicalName -}} + +<cite> +{{- with .Params.feedRaw -}} +<a title="{{ $.Site.BaseURL }}/{{ . }}" href="{{ $.Site.BaseURL }}/{{ . }}"> +{{- else -}} +<a title="{{ .Site.BaseURL }}/raw/{{ $source }}" href="{{ .Site.BaseURL }}/raw/{{ $source }}"> +{{- end -}} + raw +</a> +</cite> diff --git a/themes/default/layouts/partials/word-count.html b/themes/default/layouts/partials/meta-word-count.html index f566b07..f566b07 100644 --- a/themes/default/layouts/partials/word-count.html +++ b/themes/default/layouts/partials/meta-word-count.html diff --git a/themes/default/layouts/partials/meta.html b/themes/default/layouts/partials/meta.html deleted file mode 100644 index 608f3dc..0000000 --- a/themes/default/layouts/partials/meta.html +++ /dev/null @@ -1,64 +0,0 @@ -{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} -{{ $source := print $author.user "/messages/" .File.LogicalName }} - -<micro-thumbnail hidden> - {{ partial "profile-picture.html" . }} -</micro-thumbnail> - -<section> - {{ if or .Weight .Params.Liked }} - <anchored-entry> - - {{ if .Weight }} - <anchored-pinned> - {{ safeHTML (readFile "static/icons/tabler/pinned.svg") }} - </anchored-pinned> - <span>Pinned</span> - {{ end }} - - {{ if .Params.Liked }} - <anchored-liked> - {{ safeHTML (readFile "static/icons/feather/heart.svg") }} - </anchored-liked> - <span>Liked</span> - {{ end }} - - </anchored-entry> - {{ end }} - - <h2><b>{{ partial "author-name.html" . }}</b></h2> - - · {{ partial "handle.html" . }} - - {{ if .Draft }} - · <draft-label><em>Draft</em></draft-label> - {{ end }} - - · {{- partial "read-time.html" . -}} - - · {{- partial "word-count.html" . -}} - - {{ if .Params.Unlisted }} - · <unlisted-entry title="This message is off the record"> - {{ safeHTML (readFile "static/icons/feather/eye-off.svg") }} - <span>unlisted</span></unlisted-entry> - {{ end }} - - · <a href="{{ .Site.BaseURL }}/{{ $author.user }}/messages/{{ path.Base .Permalink }}#{{ partial "card-id.html" . }}"> - <time - datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" - title="{{ .Date | time.Format "Monday, January 2, 2006 at 15:04:05 MST" }}"> - {{ (.Date.Local | time.Format "3:04 PM Jan 2 2006") }} - </time> - </a> - - {{- if .ExpiryDate -}} - · {{- partial "expiry-date.html" . -}} - {{- end -}} - - · <cite><a title="#{{ partial "card-id.html" . }}" href="#{{ partial "card-id.html" . }}">#id</a></cite> - - {{ if not .ExpiryDate }} - · <cite><a title="{{ .Site.BaseURL }}/raw/{{ $source }}" href="{{ .Site.BaseURL }}/raw/{{ $source }}">raw</a></cite> - {{- end -}} -</section> |