feat(docs): migrate to slimsearch and restructure vuepress config
- Replace default search plugin with slimsearchPlugin and configure phrase matching - Refactor client configuration by splitting plausible analytics into dedicated file - Add custom Layout component with Mint System branding in navbar - Remove Changelog and Mint System links from navigation - Move register-module-repos script to bin directory - Update task runner to reference new script path - Add pnpm-workspace.yaml to gitignore - Create empty styles/index.scss file
This commit is contained in:
9 files changed
+94
-26
No files matched your search
@@ -8,6 +8,7 @@ node_modules
|
||||
.temp
|
||||
.cache
|
||||
dist
|
||||
pnpm-workspace.yaml
|
||||
|
||||
# File management
|
||||
|
||||
@@ -63,4 +64,5 @@ upgrade-util
|
||||
odoo-build-vault
|
||||
|
||||
# Jupyter Notebooks
|
||||
|
||||
.ipynb_checkpoints
|
||||
+37
-12
@@ -1,15 +1,40 @@
|
||||
import { defineClientConfig } from '@vuepress/client'
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import { defineSearchConfig } from '@vuepress/plugin-slimsearch/client'
|
||||
import Layout from './layouts/Layout.vue'
|
||||
|
||||
const { domain = undefined } = __PLAUSIBLE_OPTIONS__
|
||||
// A snippet is an array of tokens: plain strings, or ['mark', matchedText] tuples.
|
||||
const flattenSnippet = (snippet) =>
|
||||
snippet.map((word) => (Array.isArray(word) ? word[1] : word)).join('')
|
||||
|
||||
defineSearchConfig({
|
||||
combineWith: 'AND',
|
||||
resultsFilter: (results, query) => {
|
||||
const phrase = query.trim().toLowerCase()
|
||||
if (!phrase.includes(' ')) return results // single word — no phrase check needed
|
||||
|
||||
return results
|
||||
.map((result) => {
|
||||
const matchedContents = result.contents
|
||||
.map((item) => {
|
||||
const matchedSnippets = item.display.filter((snippet) =>
|
||||
flattenSnippet(snippet).toLowerCase().includes(phrase),
|
||||
)
|
||||
return matchedSnippets.length
|
||||
? { ...item, display: matchedSnippets }
|
||||
: null
|
||||
})
|
||||
.filter(Boolean)
|
||||
|
||||
return matchedContents.length
|
||||
? { ...result, contents: matchedContents }
|
||||
: null
|
||||
})
|
||||
.filter(Boolean)
|
||||
},
|
||||
})
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance({ router }) {
|
||||
if (!__VUEPRESS_SSR__) {
|
||||
var script = document.createElement('script')
|
||||
script.defer = true
|
||||
script.dataset.domain = domain
|
||||
script.src = "https://plausible.io/js/script.js"
|
||||
document.getElementsByTagName('head')[0].appendChild(script)
|
||||
}
|
||||
}
|
||||
})
|
||||
layouts: {
|
||||
Layout,
|
||||
},
|
||||
})
|
||||
+7
-12
@@ -40,8 +40,6 @@ export default defineUserConfig({
|
||||
{ text: 'Snippets', link: '/snippets' },
|
||||
{ text: 'Revisions', link: '/revisions' },
|
||||
{ text: 'Modules', link: '/modules' },
|
||||
{ text: 'Changelog', link: '/CHANGELOG' },
|
||||
{ text: 'Mint System', link: 'https://www.mint-system.ch/odoo' },
|
||||
{ text: 'Chat', link: 'https://matrix.to/#/!gmucNdFKeaGvdzcGTP:mint-system.ch?via=mint-system.ch'}
|
||||
],
|
||||
sidebar: {
|
||||
@@ -92,10 +90,6 @@ export default defineUserConfig({
|
||||
text: 'Modules',
|
||||
link: '/modules',
|
||||
},
|
||||
{
|
||||
text: 'Changelog',
|
||||
link: '/CHANGELOG',
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -109,13 +103,14 @@ export default defineUserConfig({
|
||||
}
|
||||
}),
|
||||
plugins: [
|
||||
// slimsearchPlugin({
|
||||
// indexContent: true,
|
||||
// suggestion: false
|
||||
// }),
|
||||
searchPlugin({
|
||||
maxSuggestions: 10,
|
||||
slimsearchPlugin({
|
||||
indexContent: true,
|
||||
suggestion: false,
|
||||
sortStrategy: "total"
|
||||
}),
|
||||
// searchPlugin({
|
||||
// maxSuggestions: 10,
|
||||
// }),
|
||||
plausiblePlugin({
|
||||
'domain': 'odoo.build'
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<script setup>
|
||||
import ParentLayout from '@vuepress/theme-default/layouts/Layout.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ParentLayout>
|
||||
<template #navbar-before>
|
||||
<a href="https://www.mint-system.ch/" target="_blank" rel="noopener noreferrer" class="mint-system-brand">Mint System GmbH</a>
|
||||
</template>
|
||||
</ParentLayout>
|
||||
</template>
|
||||
|
||||
<style lang="css">
|
||||
.mint-system-brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-right: 1rem;
|
||||
padding: 0.35rem 0.9rem;
|
||||
border-radius: 6px;
|
||||
background-color: #14d6c4;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.mint-system-brand:hover {
|
||||
background-color: #0B9FA3;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,7 @@ const name = '@mint-system/plugin-plausible'
|
||||
const plausiblePlugin = ({ domain }) => {
|
||||
return {
|
||||
name,
|
||||
clientConfigFile: path.resolve(__dirname, 'client.js'),
|
||||
clientConfigFile: path.resolve(__dirname, 'plausibleClient.js'),
|
||||
define: {
|
||||
__PLAUSIBLE_OPTIONS__: { domain },
|
||||
},
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { defineClientConfig } from '@vuepress/client'
|
||||
|
||||
const { domain = undefined } = __PLAUSIBLE_OPTIONS__
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance({ router }) {
|
||||
if (!__VUEPRESS_SSR__) {
|
||||
var script = document.createElement('script')
|
||||
script.defer = true
|
||||
script.dataset.domain = domain
|
||||
script.src = "https://plausible.io/js/script.js"
|
||||
document.getElementsByTagName('head')[0].appendChild(script)
|
||||
}
|
||||
}
|
||||
})
|
||||
Whitespace-only changes.
File renamed without changes.
Reference in new issue
Block a user