Skip to content

Commit 678d7c8

Browse files
committed
fix(open_graph): incorrect usage of config.url
1 parent a9b3b32 commit 678d7c8

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/plugins/helper/open_graph.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
'use strict';
22

3-
<<<<<<< HEAD
43
const { parse, resolve } = require('url');
54
const { isMoment, isDate } = require('moment');
6-
const { encodeURL, htmlTag, stripHTML, escapeHTML } = require('hexo-util');
7-
=======
8-
const urlFn = require('url');
9-
const moment = require('moment');
10-
const { htmlTag, prettyUrls, stripHTML, escapeHTML } = require('hexo-util');
11-
>>>>>>> fix(open_graph-helper): pass all pretty_urls options
5+
const { prettyUrls, htmlTag, stripHTML, escapeHTML } = require('hexo-util');
6+
127
const localeMap = {
138
'en': 'en_US',
149
'de': 'de_DE',
@@ -50,7 +45,7 @@ function openGraphHelper(options = {}) {
5045
let keywords = page.keywords || (page.tags && page.tags.length ? page.tags : undefined) || config.keywords;
5146
const title = options.title || page.title || config.title;
5247
const type = options.type || (this.is_post() ? 'article' : 'website');
53-
const url = prettyUrls(options.url || this.url || config.url, config.pretty_urls);
48+
const url = prettyUrls(options.url || this.url, config.pretty_urls);
5449
const siteName = options.site_name || config.title;
5550
const twitterCard = options.twitter_card || 'summary';
5651
const date = options.date !== false ? options.date || page.date : false;

test/scripts/helpers/open_graph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('open_graph', () => {
3434
}).should.eql([
3535
meta({property: 'og:type', content: 'website'}),
3636
meta({property: 'og:title', content: hexo.config.title}),
37-
meta({property: 'og:url', content: escapeHTML(hexo.config.url)}),
37+
meta({property: 'og:url'}),
3838
meta({property: 'og:site_name', content: hexo.config.title}),
3939
meta({property: 'og:locale', content: 'en_US'}),
4040
meta({property: 'article:published_time', content: post.date.toISOString()}),

0 commit comments

Comments
 (0)