feat: add correct link to article in new site

Thanks to the changes in electronjs.org-new we can now generate a
direct link to the exact article a user is visiting to make the
transition from one to another easier.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Rel cf657d5f30
This commit is contained in:
Antón Molleda 2021-07-19 21:38:24 -07:00 коммит произвёл Antón Molleda
Родитель 16d80c174c
Коммит 7d1fa0678b
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -84,6 +84,17 @@ app.use(
referrerPolicy: false,
})
)
// Helper to generate the redirects to the right document in the new docs paths
hbs.registerHelper('new-docs', (currentPage) => {
// This particular page is the root for the docs in the new site
if (!currentPage || currentPage.endsWith('tutorial/introduction')) {
return '/docs/latest/'
} else {
return currentPage.replace('docs/', 'docs/latest/')
}
})
if (isProduction) {
const jsManifest = require(path.join(
__dirname,

Просмотреть файл

@ -1,3 +1,3 @@
<div class="announcement-banner-contrast">
Want to check our <a href="/docs/latest/">beta docs site</a>? We'd love your feedback.
Want to check our <a href="{{new-docs page.url}}">beta docs site</a>? We'd love your feedback.
</div>