ybbond

My site. The main domain
Log | Files | Refs | README | LICENSE | CC-LICENSE

commit e71edccf0c57758acddf3055d5f1673fd19ee64f
parent 47776d31c8b5cd02ece4d5486bf71f4510aed988
Author: Yohanes Bandung <bandungpenting@gmail.com>
Date:   Sat,  2 May 2020 16:01:05 +0700

feature: twitter card metas

Diffstat:
Mconfig.dev.toml | 2+-
Mconfig.toml | 2+-
Mcontent/posts/In Search of Good Writing App - Part 2, iA Writer vs iVim/index.md | 2+-
Mcontent/posts/NuPhy NuType F1 Keyboard Review/index.md | 2++
Mlayouts/partials/head/head.html | 3++-
Alayouts/partials/head/twitter-card-metas.html | 10++++++++++

6 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/config.dev.toml b/config.dev.toml
@@ -7,7 +7,7 @@ title = "YBBond"
 
 [params]
   author = "Yohanes Bandung Bondowoso"
-  description = "Thoughts, ideas and writings of me, Yohanes Bandung."
+  description = "Thoughts, Ideas and Writings."
   mainSiteURL = "https://ybbond.dev"
   email = "bandungpenting@gmail.com"
   twitter = "bandungpenting"
diff --git a/config.toml b/config.toml
@@ -7,7 +7,7 @@ title = "YBBond"
 
 [params]
   author = "Yohanes Bandung Bondowoso"
-  description = "Thoughts, ideas and writings of me, Yohanes Bandung."
+  description = "Thoughts, Ideas and Writings."
   mainSiteURL = "https://ybbond.dev"
   email = "bandungpenting@gmail.com"
   twitter = "bandungpenting"
diff --git a/content/posts/In Search of Good Writing App - Part 2, iA Writer vs iVim/index.md b/content/posts/In Search of Good Writing App - Part 2, iA Writer vs iVim/index.md
@@ -7,7 +7,7 @@ tags:
   - Apple Apps #apple_apps
 date: 2020-04-01T18:22:31
 image:
-  src: https://cdn.ybbond.dev/pictures/blog/2020-04-01-in-search-of-good-writing-app-part-2/ia-writer-headline.jpg
+  src: ia-writer-headline.jpg
 ---
 
 > “Orang emang gak pernah puas!” - Indonesian colloquial sayings
diff --git a/content/posts/NuPhy NuType F1 Keyboard Review/index.md b/content/posts/NuPhy NuType F1 Keyboard Review/index.md
@@ -4,6 +4,8 @@ author: Yohanes Bandung Bondowoso
 tags:
   - Review #review
 description: I backed a project for mechanical keyboard on Kickstarter early 2020. Last week, it arrived to my home.
+image:
+  src: nutype-under-ipad.jpg
 date: 2020-04-05T18:23:12
 ---
 
diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html
@@ -17,7 +17,7 @@
 <link href="https://micro.blog/indieauth/auth" rel="authorization_endpoint" />
 <link href="https://micro.blog/indieauth/token" rel="token_endpoint" />
 
-<title>{{ with .Page.Title }}{{ . }} ::{{ end }} {{ .Site.Params.Author }}</title>
+<title>{{ with or (.Page.Title) (.Site.Title) }}{{ . }} ::{{ end }} {{ .Site.Params.Author }}</title>
 
 <meta
   name="description"
@@ -40,3 +40,4 @@
 <link rel="sitemap" href="{{ "sitemap.xml" | absURL }}" type="application/xml" />
 
 {{ partial "head/og-metas.html" . }}
+{{ partial "head/twitter-card-metas.html" . }}
diff --git a/layouts/partials/head/twitter-card-metas.html b/layouts/partials/head/twitter-card-metas.html
@@ -0,0 +1,10 @@
+<meta name="twitter:card" content="{{ cond (or (isset .Params.Twitter "image") (isset .Params.Image "src")) "summary_large_image" "summary"}}">
+{{ $titleHome := (printf "%s :: %s" .Site.Title .Site.Params.Author) }}
+{{ $titleRest := (printf "%s :: %s" .Title  .Site.Title ) }}
+{{ $defaultDesc := cond (isset .Site "description") .Description (printf "%s by %s" .Site.Params.Description .Site.Params.Author) }}
+<meta name="twitter:title" content="{{ cond .IsHome $titleHome $titleRest }}">
+<meta name="twitter:url" content="{{ .Permalink }}">
+<meta name="twitter:description" content="{{ cond .IsHome .Site.Params.Description (.Params.Twitter.Description | default $defaultDesc) }}">
+<meta name="twitter:image" content="{{ .Params.Twitter.Image | default (printf "%s%s" .Permalink .Params.Image.Src) | default "logo.png" | absURL }}">
+<meta name="twitter:site" content="@{{ .Params.Twitter.Site | default .Site.Params.twitter }}">
+<meta name="twitter:creator" content="@{{ .Params.Twitter.Site | default .Site.Params.twitter }}">