diff --git a/.changeset/wise-lemons-obey.md b/.changeset/wise-lemons-obey.md new file mode 100644 index 0000000..a3394db --- /dev/null +++ b/.changeset/wise-lemons-obey.md @@ -0,0 +1,5 @@ +--- +'hexo-theme-cupertino': minor +--- + +Reimplement [OGP](https://ogp.me/) with Hexo's `open_graph()` helper. The configuration options `og_enabled`, `og_image` and `og` are now deprecated. diff --git a/_config.yml b/_config.yml index 42c068e..58e4c89 100644 --- a/_config.yml +++ b/_config.yml @@ -4,12 +4,6 @@ favicon: /favicon.png # path to manifest.json manifest: /manifest.json -# [Open Graph Protocol](https://ogp.me/) -og_enabled: true -og_image: /favicon.png -og: - # customized og properties, which can replace the defaults - # show excerpt on post list show_excerpt: false diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index faff049..e1873bc 100644 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -1,4 +1,4 @@ -
prefix="og: https://ogp.me/ns#"<% } %>> + @@ -37,35 +37,7 @@ <% } %> - <% if (theme.og_enabled) { %> - <% - var og = {}; - - og['title'] = (title ? title + ' - ' : '') + config.title; - og['type'] = is_post() ? 'article' : 'website'; - og['url'] = url; - og['image'] = page.cover_image ? page.cover_image : theme.og_image; - if (is_post()) { - og['article:published_time'] = page.date.toISOString(); - og['article:author'] = config.author; - } - - if (theme['og']) { - for (const i in theme.og) { - og[i] = theme.og[i]; - } - } - - if (page['og']) { - for (const i in page.og) { - og[i] = page.og[i]; - } - } - %> - <% for (const i in og) { %> - - <% } %> - <% } %> + <%- open_graph() %> <% if (theme.simple_icons) { %> <%- css(getCdnUrl('simple-icons-font', 'v13', 'font/simple-icons.min.css')) %>