Skip to content

Getting Started

๐Ÿง Create Folder

cmd
mkdir vitepress-theme

๐Ÿฆ Move Folder

cmd
cd ./vitepress-theme

๐Ÿฆ‰ Create Package.json

cmd
npm init -y

๐Ÿฆš NPM Install

cmd
npm install vitepress vitepress-simple-theme

๐Ÿฆฉ Set Package.json

json
{
    "name": "vitepress-theme",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "dev": "vitepress dev",
        "build": "vitepress build"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "vitepress": "^1.0.0-alpha.4",
        "vitepress-simeple-theme": "^0.3.2"
    }
}

๐Ÿฆœ Directory Structure

Directory Structure

  • ๐Ÿ“ node_modules/
  • ๐Ÿ“ .vitepress/
    • ๐Ÿ“ theme/
      • ๐Ÿ“’ index.js
    • ๐Ÿ“’ config.js
  • ๐Ÿ“docs/
    • ๐Ÿ“ guide/
      • ๐Ÿ“— Hello.md
    • ๐Ÿ“— index.md
  • ๐Ÿ“™ packge-lock.json
  • ๐Ÿ“™ packge.json

๐Ÿฆข Set Config.js

js
// .vitepress/config.js
const path = require("path");

const rootDir = path.resolve(__dirname, "../");
const mdDir = path.resolve(rootDir, "docs");

export default {
    title: "Hello Friend",
    description:
        "Theme for sharing created using vitepress. Please use it a lot ๐Ÿ˜Š",
    srcDir: mdDir,
    themeConfig: {
        nav: [
            {
                text: "guide",
                link: "/guide/hello",
                activeMatch: "/guide/",
            },
        ],
        sidebar: {
            "/guide/": [
                {
                    text: " WELCOME ",
                    items: [
                        {
                            text: "ยท Hello Friend",
                            link: "/guide/hello",
                        },
                    ],
                },
            ],
            "/": [
                {
                    text: "GUIDE",
                    items: [
                        {
                            text: " ยท Hello",
                            link: "/guide/hello",
                        },
                    ],
                },
            ],
        },
    },
    vite: {
        ssr: { format: "cjs" },
    },
};

๐Ÿฆ… Set Index.js

js
// // .vitepress/theme/index.js
import Theme from "vitepress-simple-theme";
export default Theme;

๐Ÿฆƒ Set Home Markdown

md
---
title: "WELCOME FRIEND"
image: https://images.unsplash.com/photo-1526716173434-a1b560f2065d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80
---

๐Ÿ“ Set Hello Markdown