From f4969a4e36bea98c3f4e7c8d8ed3ae144f1df264 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 27 Feb 2022 12:06:17 +0800 Subject: [PATCH] Fix error for null `theme.open_graph.options` (#470) --- _config.yml | 1 - layout/_partials/head/head-unique.njk | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index f4b3f00..5c6246b 100644 --- a/_config.yml +++ b/_config.yml @@ -77,7 +77,6 @@ creative_commons: open_graph: enable: true options: - type: website #twitter_card: #twitter_id: #twitter_site: diff --git a/layout/_partials/head/head-unique.njk b/layout/_partials/head/head-unique.njk index 5fe40ce..8994944 100644 --- a/layout/_partials/head/head-unique.njk +++ b/layout/_partials/head/head-unique.njk @@ -1,5 +1,9 @@ {%- if theme.open_graph.enable %} - {{ open_graph(theme.open_graph.options) }} + {%- if theme.open_graph.options %} + {{ open_graph(theme.open_graph.options) }} + {%- else %} + {{ open_graph() }} + {%- endif %} {%- endif %} {# https://github.com/theme-next/hexo-theme-next/issues/866 #}