Provide absolute blog url in sitemap
No issue - Adds {{blog-url}} to sitemap.xsl - Replaces all occurences of {{blog-url}} with absolute bkog url
This commit is contained in:
parent
e0f65b899e
commit
cbcda2faf8
@ -203,7 +203,8 @@ function checkSSL(req, res, next) {
|
||||
// Handles requests to robots.txt and favicon.ico (and caches them)
|
||||
function serveSharedFile(file, type, maxAge) {
|
||||
var content,
|
||||
filePath = path.join(config.paths.corePath, 'shared', file);
|
||||
filePath = path.join(config.paths.corePath, 'shared', file),
|
||||
re = /(\{\{blog-url\}\})/g;
|
||||
|
||||
return function serveSharedFile(req, res, next) {
|
||||
if (req.url === '/' + file) {
|
||||
@ -216,7 +217,7 @@ function serveSharedFile(file, type, maxAge) {
|
||||
return next(err);
|
||||
}
|
||||
if (type === 'text/xsl' || type === 'text/plain') {
|
||||
buf = buf.toString().replace('{{blog-url}}', config.url.replace(/\/$/, ''));
|
||||
buf = buf.toString().replace(re, config.url.replace(/\/$/, ''));
|
||||
}
|
||||
content = {
|
||||
headers: {
|
||||
|
@ -95,7 +95,7 @@
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) < 1">
|
||||
<p class="desc"><a href="/sitemap.xml" class="back-link">← Back to index</a></p>
|
||||
<p class="desc"><a href="{{blog-url}}/sitemap.xml" class="back-link">← Back to index</a></p>
|
||||
<table id="sitemap" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -135,23 +135,9 @@
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="desc"><a href="/sitemap.xml" class="back-link">← Back to index</a></p>
|
||||
<p class="desc"><a href="{{blog-url}}/sitemap.xml" class="back-link">← Back to index</a></p>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
window.onload = function() {
|
||||
var sitemapIndex = window.location.href.replace(/sitemap-.*\.xml$/, 'sitemap.xml'),
|
||||
links = document.querySelectorAll('.back-link'),
|
||||
i;
|
||||
if (links.length > 0) {
|
||||
for (i = 0; i < links.length; ++i) {
|
||||
links[i].href = sitemapIndex;
|
||||
}
|
||||
}
|
||||
};
|
||||
]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user