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

View File

@ -1,9 +1,11 @@
import { HeadAttrsConfig } from 'vuepress';
interface SimplifiedHeader {
tag: string;
content: [any];
content: HeadAttrsConfig[];
}
const simplifiedHead = [
const simplifiedHead: SimplifiedHeader[] = [
{
tag: 'meta',
content: [
@ -117,12 +119,16 @@ const simplifiedHead = [
},
];
let head = [];
let headBuilder = [];
simplifiedHead.forEach((tag) => {
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',
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",
"private": true,
"devDependencies": {
"@vuepress/bundler-vite": "^2.0.0-rc.2",
"@vuepress/theme-default": "^2.0.0-rc.2",
"cz-conventional-changelog": "^3.3.0",
"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": {
"dev": "vuepress dev content",
@ -19,12 +22,12 @@
"dependencies": {
"less": "^4.1.3",
"nord": "^0.2.1",
"rxjs": "^7.8.1",
"vuepress-plugin-remove-html-extension": "^0.1.0"
"rxjs": "^7.8.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
},
"packageManager": "yarn@4.0.2"
}

7506
yarn.lock

File diff suppressed because it is too large Load Diff