Skip to content

Commit f703ad8

Browse files
committed
Partially revert 161df35, 7d79ce4, 0c22de2, e2274ec, a7eb8b7.
The root cause is a bug in metalsmith-permalinks.
1 parent a205d4b commit f703ad8

7 files changed

Lines changed: 9 additions & 12 deletions

File tree

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 }}/{{ slashes post.path }}/">{{ post.title }}</a>
16+
<a href="/{{ ../site.locale }}/{{ post.path }}/">{{ post.title }}</a>
1717

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

layouts/category-index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
<ul class="blog-index">
1515
{{#each collections.blog}}
1616
{{#unless listing}}
17-
{{#startswith path (slashes ../path)}}
17+
{{#startswith path ../path}}
1818
{{#if title}}
1919
<li>
2020
<time datetime="{{ strftime date '%FT%T%z' }}">{{ strftime date "%d %b %y" }}</time>
21-
<a href="/{{../site.locale}}/{{ slashes path }}/">{{ title }}</a>
21+
<a href="/{{../site.locale}}/{{ 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}}/{{ slashes path }}/">{{ title }}</a></li>
19+
<li><a href="/{{../site.locale}}/{{ 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
@@ -30,7 +30,7 @@
3030
<meta name="twitter:image" content="https://nodejs.org/static/images/logo-hexagon-card.png">
3131
<meta name="twitter:image:alt" content="The Node.js Hexagon Logo">
3232

33-
<link rel="canonical" href="{{ site.url }}{{#if path}}{{ slashes path }}/{{/if}}">
33+
<link rel="canonical" href="{{ site.url }}{{#if path}}{{ path }}/{{/if}}">
3434
{{#each site.feeds}}
3535
<link rel="alternate" href="/{{ ../site.locale }}/{{ link }}" title="{{ text }}" type="application/rss+xml">
3636
{{/each}}

scripts/helpers/slashes.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

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.replace(/\\/g, '/')}/">Read more...</a></p>`
33+
summary += `<p><a href="/${locale}/${path}/">Read more...</a></p>`
3434
return false
3535
}
3636

scripts/plugins/githubLinks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
// This middleware adds "Edit on GitHub" links to every editable page
44
function githubLinks (options) {
55
return (files, m, next) => {
6-
// add suffix (".html" or "/" or "\" for Windows) to each part of regex
6+
// add suffix (".html" or "/") to each part of regex
77
// to ignore possible occurrences in titles (e.g. blog posts)
8-
const isEditable = /security\.html|about(\/|\\)|docs(\/|\\)|foundation(\/|\\)|get-involved(\/|\\)|knowledge(\/|\\)/
8+
const isEditable = /security\.html|about\/|docs\/|foundation\/|get-involved\/|knowledge\//
99

1010
Object.keys(files).forEach((path) => {
1111
if (!isEditable.test(path)) {
1212
return
1313
}
1414

1515
const file = files[path]
16-
const url = `https://github.com/nodejs/nodejs.org/edit/master/locale/${options.locale}/${path.replace('.html', '.md').replace(/\\/g, '/')}`
16+
const url = `https://github.com/nodejs/nodejs.org/edit/master/locale/${options.locale}/${path.replace('.html', '.md')}`
1717
const editText = options.site.editOnGithub || 'Edit on GitHub'
1818

1919
const contents = file.contents.toString().replace(/<h1(.*?)>(.*?)<\/h1>/, (match, $1, $2) => {

0 commit comments

Comments
 (0)