aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/templates/author.yaml16
-rw-r--r--assets/templates/markdown-frontmatter.yaml5
-rw-r--r--config.json9
-rw-r--r--config.toml5
-rw-r--r--config.yaml6
-rw-r--r--content/canory/_index.md4
-rw-r--r--content/canory/drafts/_index.md4
-rw-r--r--content/canory/feeds/_index.md4
-rw-r--r--content/canory/likes/_index.md4
-rw-r--r--content/canory/media/_index.md4
-rw-r--r--content/default/_index.md4
-rw-r--r--content/default/drafts/_index.md4
-rw-r--r--content/default/feeds/_index.md4
-rw-r--r--content/default/likes/_index.md4
-rw-r--r--content/default/media/_index.md4
-rw-r--r--data/canory.yaml (renamed from data/authors/canory.yaml)0
-rw-r--r--data/default.yaml (renamed from data/authors/default.yaml)0
-rw-r--r--themes/default/layouts/_default/home.authors.html12
-rw-r--r--themes/default/layouts/partials/author-domain-host.html2
-rw-r--r--themes/default/layouts/partials/author-list.html6
-rw-r--r--themes/default/layouts/partials/author-name.html2
-rw-r--r--themes/default/layouts/partials/author-user.html2
-rw-r--r--themes/default/layouts/partials/card-id.html2
-rw-r--r--themes/default/layouts/partials/context-profile.html2
-rw-r--r--themes/default/layouts/partials/count-authors.html9
-rw-r--r--themes/default/layouts/partials/footer.html2
-rw-r--r--themes/default/layouts/partials/generate-authors.html70
-rw-r--r--themes/default/layouts/partials/generate-feeds.html2
-rw-r--r--themes/default/layouts/partials/head.html3
-rw-r--r--themes/default/layouts/partials/meta-date-time.html2
-rw-r--r--themes/default/layouts/partials/meta-source.html2
-rw-r--r--themes/default/layouts/partials/meta-word-count.html2
-rw-r--r--themes/default/layouts/partials/profile-tabs.html2
-rw-r--r--themes/default/layouts/partials/profile.html2
-rw-r--r--themes/default/layouts/partials/site-title.html2
35 files changed, 139 insertions, 68 deletions
diff --git a/assets/templates/author.yaml b/assets/templates/author.yaml
new file mode 100644
index 0000000..0a0f458
--- /dev/null
+++ b/assets/templates/author.yaml
@@ -0,0 +1,16 @@
+---
+name: {{ .Name }}
+user: {{ .User }}
+blogtitle: {{ .Name }}'s Micro Blog
+wordlimit: 50
+place: Nowhere
+domain:
+ host: example.com
+ url: https://example.com
+epoch: Just now
+description: >
+ I am a nobody. Copy this [example configuration](/data/generates/authors/{{ .User }}.yaml)
+ to `data/{{ .User }}.yaml` and make me a somebody.
+webring:
+ rss:
+ json:
diff --git a/assets/templates/markdown-frontmatter.yaml b/assets/templates/markdown-frontmatter.yaml
new file mode 100644
index 0000000..9d8e2a6
--- /dev/null
+++ b/assets/templates/markdown-frontmatter.yaml
@@ -0,0 +1,5 @@
+---
+{{ range $key, $value := . -}}
+{{- $key }}: {{ $value }}
+{{ end -}}
+---
diff --git a/config.json b/config.json
index 5912179..57bbc29 100644
--- a/config.json
+++ b/config.json
@@ -9,6 +9,11 @@
"languageCode": "en-us",
"enableRobotsTXT": true,
"author": {
+ "list": [
+ "canory",
+ "default",
+ "nobody"
+ ],
"default": {
"footer": "canory",
"home": "canory",
@@ -319,6 +324,10 @@
"target": "content"
},
{
+ "source": "public/data/generates/authors",
+ "target": "data/authors"
+ },
+ {
"source": "public",
"target": "assets/public"
}
diff --git a/config.toml b/config.toml
index 1991457..92d171c 100644
--- a/config.toml
+++ b/config.toml
@@ -8,6 +8,7 @@ languageCode = "en-us"
enableRobotsTXT = true
[author]
+ list = ["canory", "default", "nobody"]
footer = "A Micro Blog\n"
[author.default]
@@ -247,5 +248,9 @@ enableRobotsTXT = true
target = "content"
[[module.mounts]]
+ source = "public/data/generates/authors"
+ target = "data/authors"
+
+ [[module.mounts]]
source = "public"
target = "assets/public"
diff --git a/config.yaml b/config.yaml
index 6d89366..c7e60dd 100644
--- a/config.yaml
+++ b/config.yaml
@@ -11,6 +11,10 @@ languageCode: en-us
enableRobotsTXT: true
author:
+ list:
+ - canory
+ - default
+ - nobody
default:
footer: canory
home: canory
@@ -213,5 +217,7 @@ module:
target: static/data
- source: public/data/generates/content
target: content
+ - source: public/data/generates/authors
+ target: data/authors
- source: public
target: assets/public
diff --git a/content/canory/_index.md b/content/canory/_index.md
deleted file mode 100644
index 9941ff9..0000000
--- a/content/canory/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: canory
-layout: section
----
diff --git a/content/canory/drafts/_index.md b/content/canory/drafts/_index.md
deleted file mode 100644
index 1f319ba..0000000
--- a/content/canory/drafts/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: canory
-layout: drafts
----
diff --git a/content/canory/feeds/_index.md b/content/canory/feeds/_index.md
deleted file mode 100644
index 6fcfc2b..0000000
--- a/content/canory/feeds/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: canory
-layout: feeds
----
diff --git a/content/canory/likes/_index.md b/content/canory/likes/_index.md
deleted file mode 100644
index 18f37aa..0000000
--- a/content/canory/likes/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: canory
-layout: likes
----
diff --git a/content/canory/media/_index.md b/content/canory/media/_index.md
deleted file mode 100644
index 8c6b976..0000000
--- a/content/canory/media/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: canory
-layout: media
----
diff --git a/content/default/_index.md b/content/default/_index.md
deleted file mode 100644
index b80df9c..0000000
--- a/content/default/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: default
-layout: section
----
diff --git a/content/default/drafts/_index.md b/content/default/drafts/_index.md
deleted file mode 100644
index 2f08e4c..0000000
--- a/content/default/drafts/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: default
-layout: drafts
----
diff --git a/content/default/feeds/_index.md b/content/default/feeds/_index.md
deleted file mode 100644
index 37996dc..0000000
--- a/content/default/feeds/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: default
-layout: feeds
----
diff --git a/content/default/likes/_index.md b/content/default/likes/_index.md
deleted file mode 100644
index 370aa96..0000000
--- a/content/default/likes/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: default
-layout: likes
----
diff --git a/content/default/media/_index.md b/content/default/media/_index.md
deleted file mode 100644
index b0b8a46..0000000
--- a/content/default/media/_index.md
+++ /dev/null
@@ -1,4 +0,0 @@
----
-author: default
-layout: media
----
diff --git a/data/authors/canory.yaml b/data/canory.yaml
index fba7750..fba7750 100644
--- a/data/authors/canory.yaml
+++ b/data/canory.yaml
diff --git a/data/authors/default.yaml b/data/default.yaml
index b73b2b9..b73b2b9 100644
--- a/data/authors/default.yaml
+++ b/data/default.yaml
diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html
index 7e38cb5..db67566 100644
--- a/themes/default/layouts/_default/home.authors.html
+++ b/themes/default/layouts/_default/home.authors.html
@@ -22,15 +22,13 @@
{{ $authors := slice }}
- {{- range $index, $data := .Site.RegularPages -}}
- {{ $authors = $authors | append $data.Type }}
+ {{- range $index, $data := .Site.Data -}}
+ {{- $authors = $authors | append $data.user -}}
{{- end -}}
- {{ $authors = uniq $authors }}
-
- {{ range $author := $authors }}
- {{ $data := index $.Site.Data.authors $author | default "default" }}
- {{ partial "author-card.html" (dict "Data" $data) }}
+ {{- range $author := (shuffle (uniq $authors)) -}}
+ {{ $data := index $.Site.Data $author | default "default" }}
+ {{ partial "author-card.html" (dict "Data" $data) }}
{{ end }}
{{ end }}
diff --git a/themes/default/layouts/partials/author-domain-host.html b/themes/default/layouts/partials/author-domain-host.html
index 5f6b7f0..5396642 100644
--- a/themes/default/layouts/partials/author-domain-host.html
+++ b/themes/default/layouts/partials/author-domain-host.html
@@ -1,2 +1,2 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") }}
{{- $author.domain.host | markdownify -}}
diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html
index a5d50cb..bfeaa16 100644
--- a/themes/default/layouts/partials/author-list.html
+++ b/themes/default/layouts/partials/author-list.html
@@ -1,13 +1,13 @@
{{ $authors := slice }}
-{{ range $index, $data := .Site.RegularPages -}}
- {{- $authors = $authors | append $data.Type -}}
+{{ range $index, $data := .Site.Data -}}
+ {{- $authors = $authors | append $data.user -}}
{{- end -}}
<author-list>
<h1>Authors</h1>
<section>
{{- range $author := first 3 (shuffle (uniq $authors)) -}}
- {{ $data := index $.Site.Data.authors $author | default "default" }}
+ {{ $data := index $.Site.Data $author | default "default" }}
{{ partial "author-card.html" (dict "Data" $data) }}
{{ end }}
</section>
diff --git a/themes/default/layouts/partials/author-name.html b/themes/default/layouts/partials/author-name.html
index 0b3b43c..a4424e4 100644
--- a/themes/default/layouts/partials/author-name.html
+++ b/themes/default/layouts/partials/author-name.html
@@ -2,7 +2,7 @@
{{- with $author -}}
{{- else -}}
- {{- $author = index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+ {{- $author = index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- end -}}
{{- $author.name | markdownify -}}
diff --git a/themes/default/layouts/partials/author-user.html b/themes/default/layouts/partials/author-user.html
index cf4e32d..797610b 100644
--- a/themes/default/layouts/partials/author-user.html
+++ b/themes/default/layouts/partials/author-user.html
@@ -2,7 +2,7 @@
{{- with $author -}}
{{- else -}}
- {{- $author = index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+ {{- $author = index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- end -}}
{{- $author.user | markdownify -}}
diff --git a/themes/default/layouts/partials/card-id.html b/themes/default/layouts/partials/card-id.html
index c2e58e5..abaf5be 100644
--- a/themes/default/layouts/partials/card-id.html
+++ b/themes/default/layouts/partials/card-id.html
@@ -1,4 +1,4 @@
-{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- $source := print $author.user "/messages/" .File.LogicalName -}}
{{- $source = replace (lower (humanize $source | truncate 50 "")) " " "-" -}}
{{ if .ExpiryDate }}
diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html
index 057e062..c64e4a2 100644
--- a/themes/default/layouts/partials/context-profile.html
+++ b/themes/default/layouts/partials/context-profile.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") }}
<context-profile>
<context-menu>
diff --git a/themes/default/layouts/partials/count-authors.html b/themes/default/layouts/partials/count-authors.html
index d96c8d2..00655a0 100644
--- a/themes/default/layouts/partials/count-authors.html
+++ b/themes/default/layouts/partials/count-authors.html
@@ -1,6 +1,7 @@
-{{ $authors := slice }}
-{{- range $index, $data := .Site.RegularPages -}}
- {{ $authors = $authors | append $data.Type }}
+{{- $authors := slice -}}
+
+{{- range $index, $data := .Site.Data -}}
+ {{- $authors = $authors | append $data.name -}}
{{- end -}}
-{{ print (lang.FormatNumberCustom 0 (len (uniq $authors))) " " "Authors" }}
+{{- print (lang.FormatNumberCustom 0 (len (uniq $authors))) " " "Authors" -}}
diff --git a/themes/default/layouts/partials/footer.html b/themes/default/layouts/partials/footer.html
index 203ac64..6cac939 100644
--- a/themes/default/layouts/partials/footer.html
+++ b/themes/default/layouts/partials/footer.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.footer) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.footer) | default "default") }}
<footer>
{{- with .Site.Author.footer -}}
diff --git a/themes/default/layouts/partials/generate-authors.html b/themes/default/layouts/partials/generate-authors.html
new file mode 100644
index 0000000..8e2081f
--- /dev/null
+++ b/themes/default/layouts/partials/generate-authors.html
@@ -0,0 +1,70 @@
+{{- range .Site.Author.list -}}
+
+ {{- if not (fileExists (print "data/" . ".yaml")) -}}
+
+ {{- $configuration := resources.Get "templates/author.yaml" -}}
+ {{- $configuration := resources.ExecuteAsTemplate
+ (print "/data/generates/authors/" . ".yaml")
+ (dict
+ "Name" (title .)
+ "User" .
+ )
+ $configuration
+ -}}
+ {{- $writeToFile := $configuration.RelPermalink -}}
+
+ {{- end -}}
+
+ {{- $markdown := resources.Get "templates/markdown-frontmatter.yaml" -}}
+
+ {{- $template := resources.ExecuteAsTemplate
+ (print "/data/generates/content/" . "/" "_index.md")
+ (dict
+ "author" .
+ "layout" "section"
+ )
+ $markdown
+ -}}
+ {{- $writeToFile := $template.RelPermalink -}}
+
+ {{- $template := resources.ExecuteAsTemplate
+ (print "/data/generates/content/" . "/feeds/" "_index.md")
+ (dict
+ "author" .
+ "layout" "feeds"
+ )
+ $markdown
+ -}}
+ {{- $writeToFile := $template.RelPermalink -}}
+
+ {{- $template := resources.ExecuteAsTemplate
+ (print "/data/generates/content/" . "/media/" "_index.md")
+ (dict
+ "author" .
+ "layout" "media"
+ )
+ $markdown
+ -}}
+ {{- $writeToFile := $template.RelPermalink -}}
+
+ {{- $template := resources.ExecuteAsTemplate
+ (print "/data/generates/content/" . "/likes/" "_index.md")
+ (dict
+ "author" .
+ "layout" "likes"
+ )
+ $markdown
+ -}}
+ {{- $writeToFile := $template.RelPermalink -}}
+
+ {{- $template := resources.ExecuteAsTemplate
+ (print "/data/generates/content/" . "/drafts/" "_index.md")
+ (dict
+ "author" .
+ "layout" "drafts"
+ )
+ $markdown
+ -}}
+ {{- $writeToFile := $template.RelPermalink -}}
+
+{{- end -}}
diff --git a/themes/default/layouts/partials/generate-feeds.html b/themes/default/layouts/partials/generate-feeds.html
index c582d02..2d996bf 100644
--- a/themes/default/layouts/partials/generate-feeds.html
+++ b/themes/default/layouts/partials/generate-feeds.html
@@ -1,4 +1,4 @@
-{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- $feeds := slice -}}
diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html
index 8eb9435..509b177 100644
--- a/themes/default/layouts/partials/head.html
+++ b/themes/default/layouts/partials/head.html
@@ -1,6 +1,7 @@
+{{- partial "generate-authors" . -}}
{{- $data :=
(dict
- "Author" (index .Site.Data.authors ((or .Params.author .Site.Author.default.home) | default "default"))
+ "Author" (index .Site.Data ((or .Params.author .Site.Author.default.home) | default "default"))
)
-}}
diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-date-time.html
index cac7e68..127785b 100644
--- a/themes/default/layouts/partials/meta-date-time.html
+++ b/themes/default/layouts/partials/meta-date-time.html
@@ -1,4 +1,4 @@
-{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- with .Params.feed.self -}}
<a href="{{ $.Site.BaseURL }}/{{ . }}">
diff --git a/themes/default/layouts/partials/meta-source.html b/themes/default/layouts/partials/meta-source.html
index 024ec26..c314cdd 100644
--- a/themes/default/layouts/partials/meta-source.html
+++ b/themes/default/layouts/partials/meta-source.html
@@ -1,4 +1,4 @@
-{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
+{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
{{- $source := print $author.user "/messages/" .File.LogicalName -}}
<cite>
diff --git a/themes/default/layouts/partials/meta-word-count.html b/themes/default/layouts/partials/meta-word-count.html
index f566b07..d4a4065 100644
--- a/themes/default/layouts/partials/meta-word-count.html
+++ b/themes/default/layouts/partials/meta-word-count.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") }}
{{ $limit := $author.wordlimit }}
{{ $wordLimit := gt .WordCount $limit }}
{{ $overLimit := sub .WordCount $limit }}
diff --git a/themes/default/layouts/partials/profile-tabs.html b/themes/default/layouts/partials/profile-tabs.html
index 9796a6d..4f2c3fb 100644
--- a/themes/default/layouts/partials/profile-tabs.html
+++ b/themes/default/layouts/partials/profile-tabs.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") }}
<tab-list>
<aside>
diff --git a/themes/default/layouts/partials/profile.html b/themes/default/layouts/partials/profile.html
index ffcc677..161f73d 100644
--- a/themes/default/layouts/partials/profile.html
+++ b/themes/default/layouts/partials/profile.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
+{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
<micro-header>
diff --git a/themes/default/layouts/partials/site-title.html b/themes/default/layouts/partials/site-title.html
index 99f027b..afa17fa 100644
--- a/themes/default/layouts/partials/site-title.html
+++ b/themes/default/layouts/partials/site-title.html
@@ -1,4 +1,4 @@
-{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.title) | default "default") }}
+{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.title) | default "default") }}
{{- if not (eq .Title $.Site.Title) -}}
{{- with or .Title .Summary -}}