Skip to content

Commit

Permalink
fix(open_graph): url might be null
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Oct 7, 2019
1 parent e6ed3f8 commit 62e6e5c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/plugins/helper/open_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ function openGraphHelper(options = {}) {
result += og('og:type', type);
result += og('og:title', title);

if (config.pretty_urls.trailing_index === false) {
url = url.replace(/index\.html$/, '');
if (url) {
if (config.pretty_urls.trailing_index === false) {
url = url.replace(/index\.html$/, '');
}
url = encodeURL(url);
}

if (url) url = encodeURL(url);
result += og('og:url', url);

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

0 comments on commit 62e6e5c

Please sign in to comment.