diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-12-28 16:08:22 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-12-29 17:02:47 +0100 |
commit | 98c973430b3d4667e8f6645628fc00284ef041e8 (patch) | |
tree | 86a17dedeb59676fd00a25a39b722c7f4155185c | |
parent | 0a8a73c47d8fe0c63425af3ab0394ae52b0f3532 (diff) | |
download | server-98c973430b3d4667e8f6645628fc00284ef041e8.tar.gz |
Add OpenGraph meta tags to display previews on social media.
-rw-r--r-- | public/images/rally-the-troops.png | bin | 3855 -> 3272 bytes | |||
-rw-r--r-- | views/head.pug | 9 | ||||
-rw-r--r-- | views/index.pug | 4 | ||||
-rw-r--r-- | views/info.pug | 1 | ||||
-rw-r--r-- | views/join.pug | 3 |
5 files changed, 16 insertions, 1 deletions
diff --git a/public/images/rally-the-troops.png b/public/images/rally-the-troops.png Binary files differindex c792857..8be7c4d 100644 --- a/public/images/rally-the-troops.png +++ b/public/images/rally-the-troops.png diff --git a/views/head.pug b/views/head.pug index 9c7eed3..3c65c23 100644 --- a/views/head.pug +++ b/views/head.pug @@ -5,6 +5,15 @@ link(rel="icon" type="image/svg+xml" href="/favicon.svg") link(rel="stylesheet" href="/fonts/fonts.css") link(rel="stylesheet" href="/style.css") +mixin social(title,description,game) + meta(property="og:title" content=title) + meta(property="og:type" content="website") + if game + meta(property="og:image" content="https://rally-the-troops.com/"+game+"/cover.2x.jpg") + else + meta(property="og:image" content="https://rally-the-troops.com/images/rally-the-troops.png") + meta(property="og:description" content=description) + mixin gamecover(title_id) a(href="/info/"+title_id) img(src=`/${title_id}/cover.1x.jpg` srcset=`/${title_id}/cover.2x.jpg 2x`) diff --git a/views/index.pug b/views/index.pug index 0a2262b..98d5ef7 100644 --- a/views/index.pug +++ b/views/index.pug @@ -3,6 +3,8 @@ doctype html html head include head + +social("Rally the Troops!", "Play historic board games on the web.") + meta(name="keywords" content="wargames, war games, block games") title Rally the Troops! style. div.list { @@ -31,7 +33,7 @@ html article h1 Rally the Troops! - p Rally the Troops! is a website where you can play historic games with other players. + p Rally the Troops! is a website where you can play historic board games online. p Registration and use is free, and there are no ads. diff --git a/views/info.pug b/views/info.pug index b579f64..86a74d0 100644 --- a/views/info.pug +++ b/views/info.pug @@ -3,6 +3,7 @@ doctype html html head include head + +social(title.title_name, "Play " + title.title_name + " on the web.", title.title_id) title= title.title_name if user meta(http-equiv="refresh" content=300) diff --git a/views/join.pug b/views/join.pug index 6055879..a982b93 100644 --- a/views/join.pug +++ b/views/join.pug @@ -3,6 +3,9 @@ doctype html html head include head + +social(game.title_name, + "Play " + game.title_name + " with " + players.map(x=>x.name).join(" and ") + ".", + game.title_id) title= game.title_name style. table { min-width: auto; } |