chore: update Vuepress, add search bar

This commit is contained in:
Lucien Cartier-Tilet 2024-01-27 16:15:57 +01:00
parent 1ff33bfd64
commit cf1147204c
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
7 changed files with 4780 additions and 2817 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ node_modules
.cache .cache
/content/.vuepress/dist/* /content/.vuepress/dist/*
*.md *.md
/.yarn/

3
.yarnrc.yml Normal file
View File

@ -0,0 +1,3 @@
enableMessageNames: false
nodeLinker: node-modules

View File

@ -1,7 +1,10 @@
import { defineUserConfig, defaultTheme } from 'vuepress'; import { defaultTheme } from '@vuepress/theme-default';
import { removeHtmlExtensionPlugin } from 'vuepress-plugin-remove-html-extension'; import { viteBundler } from '@vuepress/bundler-vite';
import head from './head'; import { defineUserConfig } from 'vuepress';
import locales from './locales'; import { searchProPlugin } from 'vuepress-plugin-search-pro';
import { head } from './head';
import { locales, searchLocales } from './locales';
import { themeLocales } from './themeLocales'; import { themeLocales } from './themeLocales';
export default defineUserConfig({ export default defineUserConfig({
@ -9,12 +12,18 @@ export default defineUserConfig({
title: 'Lucien Cartier-Tilet', title: 'Lucien Cartier-Tilet',
description: 'Site web personnel de Lucien Cartier-Tilet', description: 'Site web personnel de Lucien Cartier-Tilet',
head: head, head: head,
bundler: viteBundler({}),
markdown: { markdown: {
html: true, html: true,
linkify: true, linkify: true,
typographer: true, typographer: true,
}, },
plugins: [removeHtmlExtensionPlugin()], plugins: [
searchProPlugin({
indexContent: true,
locales: searchLocales,
}),
],
locales: locales, locales: locales,
theme: defaultTheme({ theme: defaultTheme({
contributors: false, contributors: false,

View File

@ -1,9 +1,11 @@
import { HeadAttrsConfig } from 'vuepress';
interface SimplifiedHeader { interface SimplifiedHeader {
tag: string; tag: string;
content: [any]; content: HeadAttrsConfig[];
} }
const simplifiedHead = [ const simplifiedHead: SimplifiedHeader[] = [
{ {
tag: 'meta', tag: 'meta',
content: [ content: [
@ -117,12 +119,16 @@ const simplifiedHead = [
}, },
]; ];
let head = []; let headBuilder = [];
simplifiedHead.forEach((tag) => { simplifiedHead.forEach((tag) => {
tag.content.forEach((element: any) => { tag.content.forEach((element: any) => {
head.push([tag.tag, element]); headBuilder.push([tag.tag, element]);
}); });
}); });
head.push(['a', { rel: 'me', href: 'https://emacs.ch/@phundrak' }, 'Mastodon']); headBuilder.push([
'a',
{ rel: 'me', href: 'https://emacs.ch/@phundrak' },
'Mastodon',
]);
export default head; export const head = headBuilder;

View File

@ -1,4 +1,6 @@
const locales = { import { SearchProLocaleConfig } from 'vuepress-plugin-search-pro';
export const locales = {
'/': { '/': {
lang: 'fr-FR', lang: 'fr-FR',
title: 'Lucien Cartier-Tilet', title: 'Lucien Cartier-Tilet',
@ -16,4 +18,37 @@ const locales = {
}, },
}; };
export default locales; export const searchLocales: SearchProLocaleConfig = {
'/fr/': {
cancel: 'Annuler',
placeholder: 'Rechercher',
search: 'Rechercher',
searching: 'Recherche',
defaultTitle: 'Documentation',
select: 'sélectionner',
navigate: 'naviguer',
autocomplete: 'auto-complétion',
exit: 'fermer',
queryHistory: 'Historique de recherche',
resultHistory: 'Historique des résultats',
emptyHistory: "Vider l'historique de recherche",
emptyResult: 'Aucun résultat trouvé',
loading: 'Chargement des index de recherche...',
},
'/lfn/': {
cancel: 'Cansela',
placeholder: 'Xerca',
search: 'Xerca',
searching: 'Xercante',
defaultTitle: 'Documentos',
select: 'eleje',
navigate: 'naviga',
autocomplete: 'auto-completi',
exit: 'sorti',
queryHistory: 'Historia de xerca',
resultHistory: 'Historia de resultas',
emptyHistory: 'Historia vacua',
emptyResult: 'Resultas vacua',
loading: 'Cargante la indise de xerca...',
},
};

View File

@ -8,9 +8,12 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@vuepress/bundler-vite": "^2.0.0-rc.2",
"@vuepress/theme-default": "^2.0.0-rc.2",
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
"git-cliff": "^1.1.2", "git-cliff": "^1.1.2",
"vuepress": "2.0.0-beta.61" "vuepress": "2.0.0-rc.2",
"vuepress-plugin-search-pro": "^2.0.0-rc.15"
}, },
"scripts": { "scripts": {
"dev": "vuepress dev content", "dev": "vuepress dev content",
@ -19,12 +22,12 @@
"dependencies": { "dependencies": {
"less": "^4.1.3", "less": "^4.1.3",
"nord": "^0.2.1", "nord": "^0.2.1",
"rxjs": "^7.8.1", "rxjs": "^7.8.1"
"vuepress-plugin-remove-html-extension": "^0.1.0"
}, },
"config": { "config": {
"commitizen": { "commitizen": {
"path": "./node_modules/cz-conventional-changelog" "path": "./node_modules/cz-conventional-changelog"
} }
} },
"packageManager": "yarn@4.0.2"
} }

7506
yarn.lock

File diff suppressed because it is too large Load Diff