diff --git a/.gitignore b/.gitignore index 7a1d212..4e2a447 100644 --- a/.gitignore +++ b/.gitignore @@ -106,5 +106,5 @@ dist # Stores VSCode versions used for testing VSCode extensions .vscode-test -_config.yml* +_config*.yml* yarn.lock diff --git a/include/schema/common/widgets.json b/include/schema/common/widgets.json index f89c3f2..3be97f6 100644 --- a/include/schema/common/widgets.json +++ b/include/schema/common/widgets.json @@ -36,6 +36,9 @@ }, { "$ref": "/widget/subscribe_email.json" + }, + { + "$ref": "/widget/adsense.json" } ], "required": [ diff --git a/include/schema/widget/adsense.json b/include/schema/widget/adsense.json new file mode 100644 index 0000000..ed3815a --- /dev/null +++ b/include/schema/widget/adsense.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/adsense.json", + "description": "Google AdSense unit configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "adsense" + }, + "client_id": { + "type": "string", + "description": "AdSense client ID" + }, + "slot_id": { + "type": "string", + "description": "AdSense AD unit ID" + } + }, + "required": [ + "type", + "client_id", + "slot_id" + ] +} \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index 657939f..57da28e 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -19,9 +19,9 @@ widget: links: 'Links' tag_cloud: 'Tag Cloud' catalogue: 'Catalogue' - email: - title: 'Subscribe Email' - button: 'Subscribe' + subscribe_email: 'Subscribe to Updates' + subscribe: 'Subscribe' + adsense: 'Advertisement' article: more: 'Read More' comments: 'Comments' diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index af22ef3..5044492 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -19,6 +19,9 @@ widget: links: '链接' tag_cloud: '标签云' catalogue: '目录' + subscribe_email: '订阅更新' + subscribe: '订阅' + adsense: '广告' article: more: '阅读更多' comments: '评论' diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index a705b73..007e14c 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -19,9 +19,8 @@ widget: links: '連結' tag_cloud: '標籤雲' catalogue: '文章目錄' - email: - title: '訂閱 Email' - button: '訂閱' + subscribe_email: '訂閱 Email' + subscribe: '訂閱' article: more: '繼續閱讀' comments: '評論' diff --git a/layout/common/head.jsx b/layout/common/head.jsx index 0592f7e..9bf26e9 100644 --- a/layout/common/head.jsx +++ b/layout/common/head.jsx @@ -73,6 +73,11 @@ module.exports = class extends Component { images = [url_for('/img/og_image.png')]; } + let adsenseClientId = null; + if (Array.isArray(config.widgets)) { + adsenseClientId = config.widgets.find(widget => widget.type === 'adsense').client_id; + } + return
{meta_generator ? : null} @@ -109,6 +114,9 @@ module.exports = class extends Component { {hlTheme ? : null}