aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-16 20:31:51 -0500
committertdro <tdro@noreply.example.com>2022-12-16 20:31:51 -0500
commita298248eea70d434f421f63256aace027c063ffb (patch)
treedf9e093e5340b459fc57c6b8a521340a63259519
parentc07cd18abaf9a175b28431a5365e04cd0d223a0c (diff)
downloadcanory-a298248eea70d434f421f63256aace027c063ffb.tar.gz
canory-a298248eea70d434f421f63256aace027c063ffb.tar.bz2
canory-a298248eea70d434f421f63256aace027c063ffb.zip
themes/default/layouts/_default/single: Add related content
Add related configuration. May need to soon optimize the templates..
-rw-r--r--assets/css/default.css12
-rw-r--r--config.json15
-rw-r--r--config.toml13
-rw-r--r--config.yaml10
-rw-r--r--themes/default/layouts/_default/single.html28
-rw-r--r--themes/default/layouts/partials/meta-tags.html11
6 files changed, 80 insertions, 9 deletions
diff --git a/assets/css/default.css b/assets/css/default.css
index e140cad..dd3f73c 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -1234,6 +1234,15 @@ micro-content details[data-disclosure][open] ~ * {
display: inherit;
}
+micro-thread related-content footer {
+ font-size: 100%;
+ border-bottom: 1px solid;
+ border-color: #ccc;
+ border-color: var(--border-lighter);
+ margin: 0;
+ padding: 0.5rem 0;
+}
+
tab-bar {
display: inline-block;
overflow-x: auto;
@@ -1873,8 +1882,7 @@ main micro-card:first-of-type reaction-tip img {
outline: none;
}
-[hidden],
-[data-kind="page"] micro-metadata-view {
+[hidden] {
display: none;
}
diff --git a/config.json b/config.json
index f4fad5d..883e120 100644
--- a/config.json
+++ b/config.json
@@ -179,6 +179,21 @@
}
}
},
+ "related": {
+ "includeNewer": false,
+ "indices": [
+ {
+ "name": "tags",
+ "weight": 80
+ },
+ {
+ "name": "date",
+ "weight": 10
+ }
+ ],
+ "threshold": 80,
+ "toLower": false
+ },
"mediaTypes": {
"application/xslt+xml": {
"suffixes": [
diff --git a/config.toml b/config.toml
index ce885d1..50e2007 100644
--- a/config.toml
+++ b/config.toml
@@ -123,6 +123,19 @@ enableRobotsTXT = true
[params.search.verification]
+[related]
+ includeNewer = false
+ threshold = 80
+ toLower = false
+
+ [[related.indices]]
+ name = "tags"
+ weight = 80
+
+ [[related.indices]]
+ name = "date"
+ weight = 10
+
[mediaTypes]
[mediaTypes."application/xslt+xml"]
diff --git a/config.yaml b/config.yaml
index 3177b5a..a9c5b8b 100644
--- a/config.yaml
+++ b/config.yaml
@@ -113,6 +113,16 @@ params:
bing:
yandex:
+related:
+ includeNewer: false
+ indices:
+ - name: tags
+ weight: 80
+ - name: date
+ weight: 10
+ threshold: 80
+ toLower: false
+
mediaTypes:
application/xslt+xml:
suffixes:
diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html
index a32ae01..d94f514 100644
--- a/themes/default/layouts/_default/single.html
+++ b/themes/default/layouts/_default/single.html
@@ -9,7 +9,7 @@
{{ partial "navigator-middle.html"
(dict
"Title" "Message"
- "Subtitle" "Single"
+ "Subtitle" "Thread"
"Icon" "arrow-left"
"IconLabel" "Back"
"Href" "/"
@@ -20,9 +20,33 @@
<micro-thread>
{{ .Render "summary" }}
+
+ {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}}
+ {{- $related := $filteredPages | first 3 -}}
+
+ {{- with $related -}}
+ <related-content>
+ <footer>
+ <samp>
+ Related Tags
+ {{- with $.Params.tags -}}
+ {{- range $tag := first 1 $.Params.tags -}}
+ {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
+ {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}}
+ {{- end -}}
+ {{- end -}}
+ </samp>
+ </footer>
+ </related-content>
+
+ {{- range $related -}}
+ {{- .Render "summary" -}}
+ {{- end -}}
+ {{- end -}}
+
</micro-thread>
{{ end }}
{{ define "right" }}
- {{- partial "navigator-right.html" . -}}
+ {{- partial "navigator-right.html" . -}}
{{ end }}
diff --git a/themes/default/layouts/partials/meta-tags.html b/themes/default/layouts/partials/meta-tags.html
index d601b27..cd13781 100644
--- a/themes/default/layouts/partials/meta-tags.html
+++ b/themes/default/layouts/partials/meta-tags.html
@@ -1,5 +1,6 @@
-{{- with .Params.tags }}
- {{- range $tags, $tag := sort . }}
- <a href="{{ "tags/" | relURL }}{{ $tag | urlize }}/">#{{ $tag }}</a>
- {{ end }}
-{{ end }}
+{{- with .Params.tags -}}
+ {{- range $tags, $tag := sort $.Params.tags }}
+ {{ $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
+ {{- print "[#" $tag "](" $link ")" | markdownify -}}
+ {{- end -}}
+{{- end -}}