Last active
December 29, 2015 22:19
-
-
Save glassesfactory/7735301 to your computer and use it in GitHub Desktop.
jade 用 ogp mixin。
block 化して毎度書いてもいいんだろうけどタイプ数増えるしサーバーサイドやスタティック吐き出しツールで何かしらのデータソースをもとに動的に出力するのであれば mixin にしておいたほうが楽かと。
多分動くけど動作検証してないのでなんかあったら済まぬ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//- ogp をページごとに変えたい場合に使う。 | |
mixin ogp(ogpData) | |
// ogp tags | |
meta(property="og:title", content="#{ogpData.title}") | |
//- トップページはwebsite、個別ページはarticle | |
meta(property="og:type", content="article") | |
//- 記事の説明 | |
meta(property="og:description", content="#{ogpData.description}") | |
//- 記事の URL | |
meta(property="og:url", content="#{ogpData.url}") | |
//- 記事用の画像 | |
meta(property="og:image", content="#{ogpData.image}") | |
//- サイト名 | |
meta(property="og:site_name", content="#{ogpData.siteName}") | |
//- 言語 | |
meta(property="og:locale", content="#{ogp.lang}") | |
//- できればfb:app_idを利用 | |
meta(property="fb:admins", content="#{ogpData.fbid}") | |
meta(property="fb:app_id", content="#{ogpData.fbid}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype 5 | |
html(lang="ja") | |
head | |
meta(charset="utf-8") | |
block ogpArea | |
+ogp(#{ogpData}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment