aboutsummaryrefslogtreecommitdiffstats
path: root/build/layout.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-11-27 04:12:49 +0000
committers-ol <s-ol@users.noreply.github.com>2018-11-27 04:12:49 +0000
commitcb1e9788307308b1c13cfbbc9e3ad05755f17c5c (patch)
tree1c7efcb18abcbf3cc4fe377183f35c3a6385c660 /build/layout.moon
parentadd all the demoloops (diff)
downloadmmm-cb1e9788307308b1c13cfbbc9e3ad05755f17c5c.tar.gz
mmm-cb1e9788307308b1c13cfbbc9e3ad05755f17c5c.zip
fix og:url
Diffstat (limited to 'build/layout.moon')
-rw-r--r--build/layout.moon27
1 files changed, 27 insertions, 0 deletions
diff --git a/build/layout.moon b/build/layout.moon
index c188db9..5548281 100644
--- a/build/layout.moon
+++ b/build/layout.moon
@@ -56,4 +56,31 @@ logo = svg {
{ height: '1.3em', 'margin-left': '.3em', 'margin-top': '-0.12em' }
}
}
+ get_meta: =>
+ title = (@get 'title: text/plain') or @gett 'name: alpha'
+
+ l = (str) ->
+ str = str\gsub '[%s\\n]+$', ''
+ str\gsub '\\n', ' '
+ e = (str) -> string.format '%q', l str
+
+ meta = "
+ <meta charset=\"UTF-8\">
+ <title>#{l title}</title>
+ "
+
+ if page_meta = @get '_meta: mmm/dom'
+ meta ..= page_meta
+ else
+ meta ..= "
+ <meta property=\"og:title\" content=#{e title} />
+ <meta property=\"og:type\" content=\"website\" />
+ <meta property=\"og:url\" content=\"https://mmm.s-ol.nu#{@path}/\" />
+ <meta property=\"og:site_name\" content=\"mmm\" />"
+
+ if desc = @get 'description: text/plain'
+ meta ..= "
+ <meta property=\"og:description\" content=#{e desc} />"
+
+ meta
}