用vuepress和宝塔创建带搜索功能的静态文档站

#用vuepress和宝塔创建带搜索功能的静态文档站

已经全部换到基于github的 hugo

vuepress 官网的文档很全了不在说明

我这里用 vuepress-theme-hope主题来搞

plaintext
mkdir fish_doc
cd fish_doc

pnpm create vuepress-theme-hope@next docs

没有 pnpm的话先安装 pnpm

可以选择中文,然后有一个博客主题 一个 docs主题,选择后者
最后一部 提示 是否查看 选 yes
打开
http://10.0.0.9:8080/

基本搜索功能
/docs/src/.vuepress/config.ts
import { searchPlugin } from '@vuepress/plugin-search'

searchPlugin({
'/': {
placeholder: '搜索',
isSearchable: (page) => page.path !== '/',
},
}),

plaintext
import { defineUserConfig } from "vuepress";
import theme from "./theme.js";
import { searchPlugin } from '@vuepress/plugin-search'

export default defineUserConfig({
  base: "/",

  title: "xxx",
   description: "just so so ..",
    port:"8902",
  theme,
   plugins: [
    searchPlugin({
      '/': {
          placeholder: '搜索',
          isSearchable: (page) => page.path !== '/',
        },
    }),
  ],

  shouldPrefetch: false,
});

评论