refactor(sitemap): utilise full_url_for()

This commit is contained in:
MDLeom 2020-07-01 08:34:40 +01:00
parent 8c8dfef58a
commit 317704fcb2
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ const env = new nunjucks.Environment()
const { join } = require('path') const { join } = require('path')
const { readFileSync } = require('fs') const { readFileSync } = require('fs')
const moment = require('moment') const moment = require('moment')
const { encodeURL } = require('hexo-util') const { encodeURL, full_url_for } = require('hexo-util')
const { format } = require('url') const { format } = require('url')
env.addFilter('uriencode', str => { env.addFilter('uriencode', str => {
@ -36,7 +36,7 @@ module.exports = function (locals) {
if (limit) posts = posts.limit(limit) if (limit) posts = posts.limit(limit)
const icon = iconCfg ? format(new URL(iconCfg, url), { unicode: true }) : '' const icon = iconCfg ? full_url_for.call(this, iconCfg) : ''
const data = template.render({ const data = template.render({
config, config,