autodiscovery link error
netgc opened this issue · comments
netgc commented
autodiscovery - Add feed autodiscovery. (Default: true)
will auto add <link rel="alternate"...
to all pages
the link url define in lib/autodiscovery.js
if (typeof type === 'string') {
autodiscoveryTag += `<link rel="alternate" href="${url_for.call(this, path)}" `
+ `title="${config.title}" type="application/${type.replace(/2$/, '')}+xml">\n`;
} else {
type.forEach((feedType, i) => {
autodiscoveryTag += `<link rel="alternate" href="${url_for.call(this, path[i])}" `
+ `title="${config.title}" type="application/${feedType.replace(/2$/, '')}+xml">\n`;
});
}
it use Relative path define in path:
parameter,but the file only generate in site root directory,Links are wrong on all pages except the home page,
so js should add ${config.root}
resolve the error:
if (typeof type === 'string') {
autodiscoveryTag += `<link rel="alternate" href="${config.root}${url_for.call(this, path)}" `
+ `title="${config.title}" type="application/${type.replace(/2$/, '')}+xml">\n`;
} else {
type.forEach((feedType, i) => {
autodiscoveryTag += `<link rel="alternate" href="${config.root}${url_for.call(this, path[i])}" `
+ `title="${config.title}" type="application/${feedType.replace(/2$/, '')}+xml">\n`;
});
}
Uiolee commented
it's not a issue.
<link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">