Skip to content

Commit 8cd6228

Browse files
committed
website: updates
1 parent 7520078 commit 8cd6228

File tree

6 files changed

+5107
-1319
lines changed

6 files changed

+5107
-1319
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This file is part of the xPack project (http://xpack.github.io).
3+
* Copyright (c) 2024 Liviu Ionescu. All rights reserved.
4+
*
5+
* Permission to use, copy, modify, and/or distribute this software
6+
* for any purpose is hereby granted, under the terms of the MIT license.
7+
*
8+
* If a copy of the license was not distributed with this file, it can
9+
* be obtained from https://opensource.org/licenses/MIT/.
10+
*/
11+
12+
import util from 'node:util';
13+
14+
export const redirects = {
15+
// fromExtensions: ['html', 'htm'], // /myPage.html -> /myPage
16+
// toExtensions: ['exe', 'zip'], // /myAsset -> /myAsset.zip (if latter exists)
17+
redirects: [
18+
// // /docs/oldDoc -> /docs/newDoc
19+
// {
20+
// to: '/docs/newDoc',
21+
// from: '/docs/oldDoc',
22+
// },
23+
// // Redirect from multiple old paths to the new path
24+
// {
25+
// to: '/docs/newDoc2',
26+
// from: ['/docs/oldDocFrom2019', '/docs/legacyDocFrom2016'],
27+
// },
28+
29+
],
30+
createRedirects(existingPath) {
31+
console.log(existingPath);
32+
// if (existingPath.includes('/evenimente')) {
33+
// // console.log(`to ${existingPath} from ${existingPath.replace('/evenimente', '/events')}`);
34+
// // Redirect from /events/X to /evenimente/X
35+
// return [
36+
// existingPath.replace('/evenimente', '/events')
37+
// ];
38+
// } else if (existingPath.includes('/amintiri')) {
39+
// // console.log(`to ${existingPath} from ${existingPath.replace('/amintiri', '/blog')}`);
40+
// // Redirect from /blog/Z to /amintiri/X
41+
// return [
42+
// existingPath.replace('/amintiri', '/blog')
43+
// ];
44+
// }
45+
// return undefined; // Return a falsy value: no redirect created
46+
// },
47+
48+
}
49+
}

website/docusaurus.config.ts

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
import {themes as prismThemes} from 'prism-react-renderer';
55
import type {Config} from '@docusaurus/types';
66
import type * as Preset from '@docusaurus/preset-classic';
7-
import logger from '@docusaurus/logger';
7+
// import logger from '@docusaurus/logger';
8+
import util from 'node:util';
9+
10+
import {redirects} from './docusaurus-config-redirects'
811

912
// The node.js modules cannot be used in modules imported in browser code:
1013
// webpack < 5 used to include polyfills for node.js core modules by default.
@@ -19,17 +22,17 @@ import fs from 'node:fs';
1922

2023
function getCustomFields() {
2124
const pwd = fileURLToPath(import.meta.url);
22-
// logger.info(pwd);
25+
// console.log(pwd);
2326

2427
// First get the version from the top package.json.
2528
const topFilePath = path.join(path.dirname(path.dirname(pwd)), 'package.json');
26-
// logger.info(filePath);
29+
// console.log(filePath);
2730
const topFileContent = fs.readFileSync(topFilePath);
2831

2932
const topPackageJson = JSON.parse(topFileContent.toString());
3033
const jsonVersion = topPackageJson.version.replace(/[.-]pre/, '');
3134

32-
logger.info(`package version: ${topPackageJson.version}`);
35+
console.log(`package version: ${topPackageJson.version}`);
3336

3437
// Remove the first part, up to the last dot.
3538
const npmSubversion = jsonVersion.replace(/^.*[.]/, '');
@@ -46,7 +49,7 @@ function getCustomFields() {
4649
let rootPackageJson
4750
try {
4851
const rootFilePath = path.join(path.dirname(path.dirname(pwd)), 'build-assets', 'package.json');
49-
// logger.info(filePath);
52+
// console.log(filePath);
5053
const rootFileContent = fs.readFileSync(rootFilePath);
5154
rootPackageJson = JSON.parse(rootFileContent.toString());
5255
} catch (error) {
@@ -81,7 +84,7 @@ function getCustomFields() {
8184
// ----------------------------------------------------------------------------
8285

8386
const customFields = getCustomFields();
84-
logger.info(customFields);
87+
console.log('customFields: ' + util.inspect(customFields));
8588

8689
// ----------------------------------------------------------------------------
8790

@@ -182,40 +185,7 @@ const config: Config = {
182185
[
183186
// https://docusaurus.io/docs/next/api/plugins/@docusaurus/plugin-client-redirects#redirects
184187
'@docusaurus/plugin-client-redirects',
185-
{
186-
// fromExtensions: ['html', 'htm'], // /myPage.html -> /myPage
187-
// toExtensions: ['exe', 'zip'], // /myAsset -> /myAsset.zip (if latter exists)
188-
redirects: [
189-
// // /docs/oldDoc -> /docs/newDoc
190-
// {
191-
// to: '/docs/newDoc',
192-
// from: '/docs/oldDoc',
193-
// },
194-
// // Redirect from multiple old paths to the new path
195-
// {
196-
// to: '/docs/newDoc2',
197-
// from: ['/docs/oldDocFrom2019', '/docs/legacyDocFrom2016'],
198-
// },
199-
],
200-
createRedirects(existingPath) {
201-
logger.info(existingPath);
202-
// if (existingPath.includes('/evenimente')) {
203-
// // logger.info(`to ${existingPath} from ${existingPath.replace('/evenimente', '/events')}`);
204-
// // Redirect from /events/X to /evenimente/X
205-
// return [
206-
// existingPath.replace('/evenimente', '/events')
207-
// ];
208-
// } else if (existingPath.includes('/amintiri')) {
209-
// // logger.info(`to ${existingPath} from ${existingPath.replace('/amintiri', '/blog')}`);
210-
// // Redirect from /blog/Z to /amintiri/X
211-
// return [
212-
// existingPath.replace('/amintiri', '/blog')
213-
// ];
214-
// }
215-
// return undefined; // Return a falsy value: no redirect created
216-
// },
217-
}
218-
}
188+
redirects
219189
],
220190
'./src/plugins/SelectReleasesPlugin',
221191
],

0 commit comments

Comments
 (0)