Skip to content

Commit 161df35

Browse files
XhmikosRSEWeiTung
authored andcommitted
Fix slashes on Windows. (#2423)
There's a bug somewhere which results in backslashes in paths when building on Windows, fix it.
1 parent 5455032 commit 161df35

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

layouts/blog-index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{#each pagination.posts}}
1414
<li>
1515
<time datetime="{{ strftime post.date '%FT%T%z' }}">{{ strftime post.date "%d %b" }}</time>
16-
<a href="/{{ ../site.locale }}/{{ post.path }}/">{{ post.title }}</a>
16+
<a href="/{{ ../site.locale }}/{{ slashes post.path }}/">{{ post.title }}</a>
1717

1818
{{#if displaySummary}}
1919
<div class="summary">

layouts/category-index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{#if title}}
1919
<li>
2020
<time datetime="{{ strftime date '%FT%T%z' }}">{{ strftime date "%d %b %y" }}</time>
21-
<a href="/{{../site.locale}}/{{ path }}/">{{ title }}</a>
21+
<a href="/{{../site.locale}}/{{ slashes path }}/">{{ title }}</a>
2222
</li>
2323
{{/if}}
2424
{{/startswith}}

layouts/knowledge-base-index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<ul class="no-padding">
1717
{{#each collections.knowledgeBase}}
1818
{{#startswith path 'knowledge/'}}
19-
<li><a href="/{{../site.locale}}/{{ path }}/">{{ title }}</a></li>
19+
<li><a href="/{{../site.locale}}/{{ slashes path }}/">{{ title }}</a></li>
2020
{{/startswith}}
2121
{{/each}}
2222
</ul>

layouts/partials/html-head.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<meta name="twitter:image" content="https://nodejs.org/static/images/logo-hexagon-card.png">
2727
<meta name="twitter:image:alt" content="The Node.js Hexagon Logo">
2828

29-
<link rel="canonical" href="{{ site.url }}{{#if path}}{{ path }}/{{/if}}">
29+
<link rel="canonical" href="{{ site.url }}{{#if path}}{{ slashes path }}/{{/if}}">
3030
{{#each site.feeds}}
3131
<link rel="alternate" href="/{{ ../site.locale }}/{{ link }}" title="{{ text }}" type="application/rss+xml">
3232
{{/each}}

scripts/helpers/slashes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict'
2+
3+
module.exports = function (str) {
4+
return process.platform === 'win32' && str.replace(/\\/g, '/')
5+
}

scripts/helpers/summary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = (contents, locale, path) => {
3030
.not((i, elem) => IGNORE_SELECTORS.some((selector) => $(elem).is(selector)))
3131
.each((i, elem) => {
3232
if (summary.length > SUMMARY_MAX_LENGTH) {
33-
summary += `<p><a href='/${locale}/${path}/'>Read more...</a></p>`
33+
summary += `<p><a href='/${locale}/${path.replace(/\\/g, '/')}/'>Read more...</a></p>`
3434
return false
3535
}
3636

0 commit comments

Comments
 (0)