Skip to content

Commit

Permalink
fix(open_graph): incorrect usage of config.url
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Dec 19, 2019
1 parent 7037ba5 commit ed78ec5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/plugins/helper/open_graph.js
Expand Up @@ -44,7 +44,7 @@ function openGraphHelper(options = {}) {
let keywords = page.keywords || (page.tags && page.tags.length ? page.tags : undefined) || config.keywords;
const title = options.title || page.title || config.title;
const type = options.type || (this.is_post() ? 'article' : 'website');
const url = prettyUrls(options.url || this.url || config.url, config.pretty_urls);
const url = prettyUrls(options.url || this.url, config.pretty_urls);
const siteName = options.site_name || config.title;
const twitterCard = options.twitter_card || 'summary';
const date = options.date !== false ? options.date || page.date : false;
Expand Down Expand Up @@ -107,7 +107,7 @@ function openGraphHelper(options = {}) {
if (!urlFn.parse(path).host) {
// resolve `path`'s absolute path relative to current page's url
// `path` can be both absolute (starts with `/`) or relative.
return urlFn.resolve(url, path);
return urlFn.resolve(url || config.url, path);
}

return path;
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/helpers/open_graph.js
Expand Up @@ -34,7 +34,7 @@ describe('open_graph', () => {
}).should.eql([
meta({property: 'og:type', content: 'website'}),
meta({property: 'og:title', content: hexo.config.title}),
meta({property: 'og:url', content: escapeHTML(hexo.config.url)}),
meta({property: 'og:url'}),
meta({property: 'og:site_name', content: hexo.config.title}),
meta({property: 'og:locale', content: 'en_US'}),
meta({property: 'article:published_time', content: post.date.toISOString()}),
Expand Down

0 comments on commit ed78ec5

Please sign in to comment.