aboutsummaryrefslogtreecommitdiffstats
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
parentadd all the demoloops (diff)
downloadmmm-cb1e9788307308b1c13cfbbc9e3ad05755f17c5c.tar.gz
mmm-cb1e9788307308b1c13cfbbc9e3ad05755f17c5c.zip
fix og:url
-rw-r--r--build/layout.moon27
-rw-r--r--build/render_fileder.moon32
2 files changed, 28 insertions, 31 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
}
diff --git a/build/render_fileder.moon b/build/render_fileder.moon
index 280be25..76c7856 100644
--- a/build/render_fileder.moon
+++ b/build/render_fileder.moon
@@ -2,7 +2,7 @@ require 'mmm'
import get_path from require 'build.util'
import tohtml from require 'mmm.component'
import Browser from require 'mmm.mmmfs.browser'
-import header, footer from require 'build.layout'
+import get_meta, header, footer from require 'build.layout'
export BROWSER
@@ -34,36 +34,6 @@ do
seed path
-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
- _path = path
- _path = '/' if _path == ''
- 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
-
root = dofile '$bundle.lua'
assert root, "couldn't load $bundle.lua"
root\mount path, true