aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.json2
-rw-r--r--config.toml3
-rw-r--r--config.yaml3
-rw-r--r--content/canory/messages/selfdestructed.md10
-rw-r--r--content/canory/messages/unlisted.md4
-rw-r--r--themes/default/layouts/_default/index.json2
-rw-r--r--themes/default/layouts/_default/rss.xml2
-rw-r--r--themes/default/layouts/_default/single.plain.txt2
-rw-r--r--themes/default/layouts/_default/summary.html6
-rw-r--r--themes/default/layouts/partials/function-content.html13
-rw-r--r--themes/default/layouts/partials/function-strings.html6
-rw-r--r--themes/default/layouts/partials/meta-expiry-date.html8
-rw-r--r--themes/default/layouts/shortcodes/version.html2
13 files changed, 42 insertions, 21 deletions
diff --git a/config.json b/config.json
index b2d2ae3..fc57fbe 100644
--- a/config.json
+++ b/config.json
@@ -6,6 +6,7 @@
"summaryLength": 1,
"enableEmoji": true,
"buildDrafts": true,
+ "buildExpired": true,
"languageCode": "en-us",
"enableRobotsTXT": true,
"author": {
@@ -139,7 +140,6 @@
"img-src": [
"'self'",
"http://preview.test",
- "imgs.xkcd.com",
"www.gutenberg.org"
],
"manifest-src": [
diff --git a/config.toml b/config.toml
index 6da97ed..386076b 100644
--- a/config.toml
+++ b/config.toml
@@ -4,6 +4,7 @@ paginate = 10
summaryLength = 1
enableEmoji = true
buildDrafts = true
+buildExpired = true
languageCode = "en-us"
enableRobotsTXT = true
@@ -108,7 +109,7 @@ enableRobotsTXT = true
font-src = ["'self'"]
form-action = ["'self'", "lite.duckduckgo.com"]
frame-src = ["'self'", "imgur.com", "www.youtube-nocookie.com", "platform.twitter.com", "en.m.wikipedia.org", "odysee.com", "www.gutenberg.org"]
- img-src = ["'self'", "http://preview.test", "imgs.xkcd.com", "www.gutenberg.org"]
+ img-src = ["'self'", "http://preview.test", "www.gutenberg.org"]
manifest-src = ["'self'"]
media-src = ["'self'", "raw.githubusercontent.com", "i.imgur.com"]
object-src = ["'self'", "www.gutenberg.org"]
diff --git a/config.yaml b/config.yaml
index 96beeeb..bb55ea4 100644
--- a/config.yaml
+++ b/config.yaml
@@ -7,6 +7,7 @@ paginate: 10
summaryLength: 1
enableEmoji: true
buildDrafts: true
+buildExpired: true
languageCode: en-us
enableRobotsTXT: true
@@ -97,7 +98,7 @@ params:
form-action: ["'self'", lite.duckduckgo.com]
frame-src: ["'self'", imgur.com, www.youtube-nocookie.com, platform.twitter.com,
en.m.wikipedia.org, odysee.com, www.gutenberg.org]
- img-src: ["'self'", http://preview.test, imgs.xkcd.com, www.gutenberg.org]
+ img-src: ["'self'", http://preview.test, www.gutenberg.org]
manifest-src: ["'self'"]
media-src: ["'self'", raw.githubusercontent.com, i.imgur.com]
object-src: ["'self'", www.gutenberg.org]
diff --git a/content/canory/messages/selfdestructed.md b/content/canory/messages/selfdestructed.md
new file mode 100644
index 0000000..79d580a
--- /dev/null
+++ b/content/canory/messages/selfdestructed.md
@@ -0,0 +1,10 @@
++++
+date = "2022-03-08T02:18:49+00:00"
+lastmod = "2022-03-08T02:18:49+00:00"
+expirydate = "2022-03-08T02:19:51+00:00"
+tags = [ "docs", "selfdestructed" ]
+author = "canory"
+slug = "cf1a1feb2"
++++
+
+This is a special message.
diff --git a/content/canory/messages/unlisted.md b/content/canory/messages/unlisted.md
index 53d9f2f..f746c77 100644
--- a/content/canory/messages/unlisted.md
+++ b/content/canory/messages/unlisted.md
@@ -1,6 +1,6 @@
+++
-date = "2022-03-08T02:20:51+00:00"
-lastmod = "2022-03-08T02:20:51+00:00"
+date = "2022-03-08T02:19:51+00:00"
+lastmod = "2022-03-08T02:19:51+00:00"
tags = [ "docs", "unlisted" ]
unlisted = true
author = "canory"
diff --git a/themes/default/layouts/_default/index.json b/themes/default/layouts/_default/index.json
index 1e672fd..86be455 100644
--- a/themes/default/layouts/_default/index.json
+++ b/themes/default/layouts/_default/index.json
@@ -32,7 +32,7 @@
{{- end -}}
],
"content_text": {{ $data.Plain | jsonify }},
- "content_html": {{ partial "function-content.html" $data.Content | jsonify }}
+ "content_html": {{ partial "function-content.html" $data | jsonify }}
}
{{- end -}}
{{ end }}
diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml
index beda119..3eee035 100644
--- a/themes/default/layouts/_default/rss.xml
+++ b/themes/default/layouts/_default/rss.xml
@@ -75,7 +75,7 @@
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>
- {{- partial "function-content.html" .Content | html -}}
+ {{- partial "function-content.html" . | html -}}
{{- print "<br>" | html -}}
{{- partial "rss-tags.html" . | html -}}
</description>
diff --git a/themes/default/layouts/_default/single.plain.txt b/themes/default/layouts/_default/single.plain.txt
index d110b5e..6b97968 100644
--- a/themes/default/layouts/_default/single.plain.txt
+++ b/themes/default/layouts/_default/single.plain.txt
@@ -1 +1 @@
-{{- .Content | plainify | htmlUnescape -}}
+{{- partial "function-content.html" . | plainify | htmlUnescape -}}
diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html
index e1e6f73..356d0d9 100644
--- a/themes/default/layouts/_default/summary.html
+++ b/themes/default/layouts/_default/summary.html
@@ -1,5 +1,7 @@
-{{- $limit := gt .WordCount 75 -}}
-{{- $content := partial "function-content.html" .Content | safeHTML -}}
+{{- $wordLimit := gt .WordCount 75 -}}
+{{- $content := partial "function-content.html" . | safeHTML -}}
+{{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}}
+{{- $limit := and $wordLimit (not $expired) -}}
{{- if $limit -}}
<input hidden type="checkbox" id="expand-{{ partial "card-id.html" . }}" />
diff --git a/themes/default/layouts/partials/function-content.html b/themes/default/layouts/partials/function-content.html
index be33ba0..de68946 100644
--- a/themes/default/layouts/partials/function-content.html
+++ b/themes/default/layouts/partials/function-content.html
@@ -1,4 +1,7 @@
-{{- $content := . -}}
+{{- $context := . -}}
+{{- $content := $context.Content -}}
+{{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}}
+{{- $empty := eq (len $content) 0 -}}
{{-
$content = $content |
@@ -7,8 +10,12 @@
replaceRE "</figure></p>" "</figure>" |
-}}
-{{- if eq (len $content) 0 -}}
- {{- $content = partial "function-strings.html" "messageNoContent" -}}
+{{- if $empty -}}
+ {{- $content = "This message contains no content." -}}
+{{- end -}}
+
+{{- if $expired -}}
+ {{- $content = "This message has expired." -}}
{{- end -}}
{{- return $content -}}
diff --git a/themes/default/layouts/partials/function-strings.html b/themes/default/layouts/partials/function-strings.html
deleted file mode 100644
index 37de01a..0000000
--- a/themes/default/layouts/partials/function-strings.html
+++ /dev/null
@@ -1,6 +0,0 @@
-{{- $string := . -}}
-
-{{- if eq $string "messageExpired" -}} {{- $string = "This message has expired." -}} {{- end -}}
-{{- if eq $string "messageNoContent" -}} {{- $string = "This message contains no content." -}} {{- end -}}
-
-{{- return $string -}}
diff --git a/themes/default/layouts/partials/meta-expiry-date.html b/themes/default/layouts/partials/meta-expiry-date.html
index e2c4838..62f01da 100644
--- a/themes/default/layouts/partials/meta-expiry-date.html
+++ b/themes/default/layouts/partials/meta-expiry-date.html
@@ -1,9 +1,15 @@
{{- if .ExpiryDate -}}
+ {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}}
{{- $diff := now.Sub .ExpiryDate -}}
{{- $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) -}}
+ {{- $date := .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
+ {{- $title := print "Self destructs within" " " $duration " " "days" " " "(" $date ")" -}}
+ {{- if $expired -}}
+ {{- $title = print "Self destructed" " " $date -}}
+ {{- end -}}
<micro-metadata-expiry
- title="Self destructs within {{ $duration }} days ({{ .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" }})">
+ title="{{ $title }}">
{{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/trash-2.svg")) -}}
<time datetime= "{{- .ExpiryDate | time.Format "2006-01-02T15:04:05Z" -}}">
{{- .ExpiryDate | time.Format "Jan 2 2006" -}}
diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html
index 3c3f173..10e29c5 100644
--- a/themes/default/layouts/shortcodes/version.html
+++ b/themes/default/layouts/shortcodes/version.html
@@ -1,4 +1,4 @@
-{{- $version := "0.11.4" -}}
+{{- $version := "0.11.5" -}}
{{- $number := default false (.Get "number" | default (.Get 0)) -}}
{{- $clone := default false (.Get "clone" | default (.Get 1)) -}}