aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--assets/css/default.css4
-rw-r--r--assets/templates/markdown.yaml9
-rw-r--r--config.json4
-rw-r--r--config.toml4
-rw-r--r--config.yaml2
-rw-r--r--themes/default/layouts/_default/feeds.html116
-rw-r--r--themes/default/layouts/partials/feeds-generate.html154
-rw-r--r--themes/default/layouts/partials/web-ring.html139
9 files changed, 183 insertions, 251 deletions
diff --git a/Makefile b/Makefile
index 1714f52..b820c65 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ js:
hugo:
rm -rf public
- hugo
+ hugo && hugo
rm -f .hugo_build.lock
server:
diff --git a/assets/css/default.css b/assets/css/default.css
index 63d98f7..1c010a2 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -1092,6 +1092,10 @@ gallery-images img:last-child {
border-bottom-right-radius: 0.5rem;
}
+main web-ring {
+ display: none;
+}
+
web-ring {
border-radius: 1rem;
position: sticky;
diff --git a/assets/templates/markdown.yaml b/assets/templates/markdown.yaml
new file mode 100644
index 0000000..109f5a1
--- /dev/null
+++ b/assets/templates/markdown.yaml
@@ -0,0 +1,9 @@
+---
+{{ range $key, $value := . -}}
+{{- if ne $key "content" -}}
+{{- $key }}: {{ $value }}
+{{ end -}}
+{{- end -}}
+---
+
+{{ .content }}
diff --git a/config.json b/config.json
index f5b51c2..f47a7b1 100644
--- a/config.json
+++ b/config.json
@@ -286,6 +286,10 @@
{
"source": "data",
"target": "static/data"
+ },
+ {
+ "source": "public/data/generators/content",
+ "target": "content"
}
]
}
diff --git a/config.toml b/config.toml
index c7d0a01..c91441a 100644
--- a/config.toml
+++ b/config.toml
@@ -215,3 +215,7 @@ enableRobotsTXT = true
[[module.mounts]]
source = "data"
target = "static/data"
+
+ [[module.mounts]]
+ source = "public/data/generators/content"
+ target = "content"
diff --git a/config.yaml b/config.yaml
index 611e53c..87f210d 100644
--- a/config.yaml
+++ b/config.yaml
@@ -191,3 +191,5 @@ module:
target: static/sources/files
- source: data
target: static/data
+ - source: public/data/generators/content
+ target: content
diff --git a/themes/default/layouts/_default/feeds.html b/themes/default/layouts/_default/feeds.html
index 473af35..238887f 100644
--- a/themes/default/layouts/_default/feeds.html
+++ b/themes/default/layouts/_default/feeds.html
@@ -31,122 +31,14 @@
{{ partial "profile.html" . }}
- {{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
-
- {{ $feeds := slice }}
-
- {{ range $key, $value := (seq 3) }}
- {{ range first 5 $author.webring.rss -}}
-
- {{ with resources.GetRemote . }}
- {{- with .Err -}}
- {{- warnf "%s" . -}}
- {{- end -}}
- {{ end }}
-
- {{ with resources.GetRemote . | transform.Unmarshal -}}
-
- {{- $title := "No Title Found" -}}
- {{- $link := "https://example.com/link" -}}
- {{- $description := "No description found." -}}
- {{- $content := "No content found." -}}
- {{- $sourceTitle := "No source title found" -}}
- {{- $sourceLink := "https://example.com/" -}}
- {{- $sourceDescription := "No source description found." -}}
- {{- $date := now.Format "January 2, 2006" -}}
- {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}}
- {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
-
- {{ with .channel -}}
-
- {{ if reflect.IsMap (index .link 0) -}}
- {{ $sourceLink = index (index .link 0) "-href" -}}
- {{ else -}}
- {{ $sourceLink = index .link 0 -}}
- {{ end -}}
-
- {{ $sourceDescription = .description -}}
-
- {{ $sourceTitle = .title -}}
-
- {{ range first $value .item -}}
- {{ $description = .description -}}
- {{ $content = .description -}}
- {{ $title = .title -}}
- {{ $link = .link -}}
- {{ $date = .pubDate -}}
- {{ $dateTime = .pubDate -}}
- {{ $dateTitle = .pubDate -}}
- {{ end -}}
-
- {{ else -}}
-
- {{ $sourceLink = index (index .link 0) "-href" -}}
- {{ $sourceTitle = .title -}}
- {{ $sourceDescription = .subtitle -}}
-
- {{ range first $value .entry -}}
-
- {{ if reflect.IsMap .title -}}
- {{ $title = index .title "#text" -}}
- {{ else -}}
- {{ $title = .title -}}
- {{ end -}}
-
- {{ $date = .updated -}}
- {{ $dateTime = .updated -}}
- {{ $dateTitle = .updated -}}
-
- {{ $link = .id -}}
-
- {{ with .content -}}
- {{ $description = index . "#text" -}}
- {{ $content = index . "#text" -}}
- {{ end -}}
- {{ with .summary -}}
- {{ $description = index . "#text" -}}
- {{ $content = index . "#text" -}}
- {{ end -}}
- {{ end -}}
-
- {{ end -}}
-
- {{
- $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")
- )
- }}
-
- {{ end }}
- {{ end }}
- {{ end }}
-
- {{ range sort $feeds "FeedDateTime" "desc" }}
- {{ partial "card-feed.html" (dict
- "FeedName" ((delimit (first 3 (split .FeedSourceTitle " ")) " ") | replaceRE "[^a-zA-Z ]" "")
- "FeedSourceDomain" (.FeedSourceLink | replaceRE "^https?://([^/]+).*" "$1")
- "FeedSourceLink" .FeedSourceLink
- "FeedContent" (print (or .FeedDescription .FeedTitle) ".")
- "FeedDate" .FeedDate
- "FeedDateTime" .FeedDateTime
- "FeedDateTitle" .FeedDateTitle
- "FeedWordCount" ((or .FeedDescription .FeedTitle) | countwords)
- "FeedLink" .FeedLink
- )
- }}
+ {{ range where .Paginator.Pages ".Params.hidden" "ne" "true" }}
+ {{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
+ {{ partial "feeds-generate" . }}
+
{{ end }}
{{ define "right" }}
diff --git a/themes/default/layouts/partials/feeds-generate.html b/themes/default/layouts/partials/feeds-generate.html
new file mode 100644
index 0000000..cec17d8
--- /dev/null
+++ b/themes/default/layouts/partials/feeds-generate.html
@@ -0,0 +1,154 @@
+{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+
+{{ $feeds := slice }}
+
+{{- if $author.webring.rss -}}
+ {{ range $key, $value := (seq 3) }}
+ {{ range $author.webring.rss -}}
+
+ {{ with resources.GetRemote . }}
+ {{- with .Err -}}
+ {{- warnf "%s" . -}}
+ {{- end -}}
+ {{ end }}
+
+ {{ with resources.GetRemote . | transform.Unmarshal -}}
+
+ {{- $title := "No Title Found" -}}
+ {{- $link := "https://example.com/link" -}}
+ {{- $description := "No description found." -}}
+ {{- $content := "No content found." -}}
+ {{- $sourceTitle := "No source title found" -}}
+ {{- $sourceLink := "https://example.com/" -}}
+ {{- $sourceDescription := "No source description found." -}}
+ {{- $date := now.Format "January 2, 2006" -}}
+ {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}}
+ {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
+
+ {{ with .channel -}}
+
+ {{ if reflect.IsMap (index .link 0) -}}
+ {{ $sourceLink = index (index .link 0) "-href" -}}
+ {{ else -}}
+ {{ $sourceLink = index .link 0 -}}
+ {{ end -}}
+
+ {{ $sourceDescription = .description -}}
+
+ {{ $sourceTitle = .title -}}
+
+ {{ range first $value .item -}}
+ {{ $description = .description -}}
+ {{ $content = .description -}}
+ {{ $title = .title -}}
+ {{ $link = .link -}}
+ {{ $date = .pubDate -}}
+ {{ $dateTime = .pubDate -}}
+ {{ $dateTitle = .pubDate -}}
+ {{ end -}}
+
+ {{ else -}}
+
+ {{ $sourceLink = index (index .link 0) "-href" -}}
+ {{ $sourceTitle = .title -}}
+ {{ $sourceDescription = .subtitle -}}
+
+ {{ range first $value .entry -}}
+
+ {{ if reflect.IsMap .title -}}
+ {{ $title = index .title "#text" -}}
+ {{ else -}}
+ {{ $title = .title -}}
+ {{ end -}}
+
+ {{ $date = .updated -}}
+ {{ $dateTime = .updated -}}
+ {{ $dateTitle = .updated -}}
+
+ {{ $link = .id -}}
+
+ {{ with .content -}}
+ {{ $description = index . "#text" -}}
+ {{ $content = index . "#text" -}}
+ {{ end -}}
+ {{ with .summary -}}
+ {{ $description = index . "#text" -}}
+ {{ $content = index . "#text" -}}
+ {{ end -}}
+ {{ end -}}
+
+ {{ end -}}
+
+ {{
+ $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")
+ )
+ }}
+
+ {{ end }}
+ {{ end }}
+ {{ end }}
+
+ {{ range $feeds }}
+ {{ $template := resources.Get "templates/markdown.yaml" }}
+ {{ $markdown := resources.ExecuteAsTemplate
+ (print "/data/generators/content/" $author.user "/feeds/" (urlize (replace .FeedTitle "/" "-")) ".md")
+ (dict
+ "content" (print (or .FeedDescription .FeedTitle) ".")
+ "tags" "[rss]"
+ "rss" true
+ "date" .FeedDateTime
+ )
+ $template
+ }}
+ {{ $writeToFile := $markdown.RelPermalink }}
+ {{ end }}
+
+ <web-ring>
+ <h1>Web Ring</h1>
+ <aside>
+ {{ range first 3 (sort $feeds "FeedDateTime" "desc") }}
+ <web-ring-item>
+ <header>
+ <a
+ rel="noopener"
+ target="_blank"
+ title="{{ .FeedLink }}"
+ href="{{ .FeedLink }}">
+ {{ .FeedTitle }}
+ </a>
+ </header>
+
+ <p>
+ <time
+ title="{{ .FeedDateTitle }}"
+ datetime="{{ .FeedDateTime }}">
+ {{ .FeedDate }}
+ </time>
+ {{- with (print .FeedDescription ".") -}}
+ {{ "--" | markdownify }}
+ {{ . }}
+ {{- end }}
+ </p>
+
+ <a
+ rel="noopener"
+ target="_blank"
+ title="{{ .FeedSourceDescription }}"
+ href="{{ .FeedSourceLink }}">
+ {{ .FeedSourceTitle }}
+ </a>
+ </web-ring-item>
+ {{ end }}
+ </aside>
+ </web-ring>
+{{ end }}
diff --git a/themes/default/layouts/partials/web-ring.html b/themes/default/layouts/partials/web-ring.html
index cca6027..1f89616 100644
--- a/themes/default/layouts/partials/web-ring.html
+++ b/themes/default/layouts/partials/web-ring.html
@@ -1,138 +1 @@
-{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
-
-{{- if $author.webring.rss -}}
-
- {{ $feeds := slice }}
-
- {{ range first 5 $author.webring.rss -}}
-
- {{ with resources.GetRemote . }}
- {{- with .Err -}}
- {{- warnf "%s" . -}}
- {{- end -}}
- {{ end }}
-
- {{ with resources.GetRemote . | transform.Unmarshal -}}
-
- {{- $title := "Example Domain" -}}
- {{- $link := "https://example.com/link" -}}
- {{- $description := "This domain is for use in illustrative examples in documents." -}}
- {{- $content := "This content is for use in illustrative examples in documents." -}}
- {{- $sourceTitle := "From Example Domain" -}}
- {{- $sourceLink := "https://example.com/" -}}
- {{- $sourceDescription := "The example domain." -}}
- {{- $date := now.Format "January 2, 2006" -}}
- {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}}
- {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
-
- {{ with .channel -}}
-
- {{ if reflect.IsMap (index .link 0) -}}
- {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}}
- {{ else -}}
- {{ $sourceLink = index .link 0 | plainify | htmlUnescape -}}
- {{ end -}}
-
- {{ $sourceDescription = .description | plainify | htmlUnescape -}}
-
- {{ $sourceTitle = .title | plainify | htmlUnescape -}}
-
- {{ range first 1 .item -}}
- {{ $description = .description | plainify | htmlUnescape | truncate 50 "..." -}}
- {{ $content = .description | plainify | htmlUnescape -}}
- {{ $title = .title | plainify | htmlUnescape -}}
- {{ $link = .link | plainify | htmlUnescape -}}
- {{ $date = .pubDate | plainify | htmlUnescape | time.Format "January 2, 2006" -}}
- {{ $dateTime = .pubDate | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}}
- {{ $dateTitle = .pubDate | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
- {{ end -}}
-
- {{ else -}}
-
- {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}}
- {{ $sourceTitle = .title | plainify | htmlUnescape -}}
- {{ $sourceDescription = .subtitle | plainify | htmlUnescape -}}
-
- {{ range first 1 .entry -}}
-
- {{ if reflect.IsMap .title -}}
- {{ $title = index .title "#text" | plainify | htmlUnescape -}}
- {{ else -}}
- {{ $title = .title | plainify | htmlUnescape -}}
- {{ end -}}
-
- {{ $date = .updated | plainify | htmlUnescape | time.Format "January 2, 2006" -}}
- {{ $dateTime = .updated | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}}
- {{ $dateTitle = .updated | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
-
- {{ $link = .id -}}
- {{ with .content -}}
- {{ $description = (index . "#text") | plainify | htmlUnescape | truncate 50 "..." -}}
- {{ $content = (index . "#text") | plainify | htmlUnescape -}}
- {{ end -}}
- {{ with .summary -}}
- {{ $description = (index . "#text") | plainify | htmlUnescape | truncate 50 "..." -}}
- {{ $content = (index . "#text") | plainify | htmlUnescape -}}
- {{ end -}}
- {{ end -}}
-
- {{ end -}}
-
- {{
- $feeds = $feeds | append (dict
- "FeedTitle" $title
- "FeedLink" $link
- "FeedDescription" $description
- "FeedContent" $content
- "FeedSourceTitle" $sourceTitle
- "FeedSourceLink" $sourceLink
- "FeedSourceDescription" $sourceDescription
- "FeedDate" $date
- "FeedDateTime" $dateTime
- "FeedDateTitle" $dateTitle
- )
- }}
-
- {{ end }}
- {{ end }}
-
- <web-ring>
- <h1>Web Ring</h1>
- <aside>
- {{ range sort $feeds "FeedDateTime" "desc" }}
- <web-ring-item>
- <header>
- <a
- rel="noopener"
- target="_blank"
- title="{{ .FeedLink }}"
- href="{{ .FeedLink }}">
- {{ .FeedTitle }}
- </a>
- </header>
-
- <p>
- <time
- title="{{ .FeedDateTitle }}"
- datetime="{{ .FeedDateTime }}">
- {{ .FeedDate }}
- </time>
- {{- with .FeedDescription -}}
- {{ "--" | markdownify }}
- {{ . }}
- {{- end }}
- </p>
-
- <a
- rel="noopener"
- target="_blank"
- title="{{ .FeedSourceDescription }}"
- href="{{ .FeedSourceLink }}">
- {{ .FeedSourceTitle }}
- </a>
- </web-ring-item>
- {{ end }}
- </aside>
- </web-ring>
-
-{{ end -}}
+{{ partial "feeds-generate" . }}