Skip to content

Commit 8bffea1

Browse files
committed
fix(open_graph): url might be null
1 parent 1990289 commit 8bffea1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/plugins/helper/open_graph.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ function openGraphHelper(options = {}) {
7878
result += og('og:type', type);
7979
result += og('og:title', title);
8080

81-
if (config.pretty_urls.trailing_index === false) {
82-
url = url.replace(/index\.html$/, '');
81+
if (url) {
82+
if (config.pretty_urls.trailing_index === false) {
83+
url = url.replace(/index\.html$/, '');
84+
}
85+
url = encodeURL(url);
8386
}
84-
85-
if (url) url = encodeURL(url);
8687
result += og('og:url', url);
8788

8889
result += og('og:site_name', siteName);

0 commit comments

Comments
 (0)