Skip to content

Latest commit

ย 

History

History
660 lines (543 loc) ยท 24.5 KB

File metadata and controls

660 lines (543 loc) ยท 24.5 KB

็ฎ€ไฝ“ไธญๆ–‡ | ็น้ซ”ไธญๆ–‡ | English | ๆ—ฅๆœฌ่ชž

MuYi Pavilion | ๆฒไฝš่‹‘้˜

For update logs, please see Site Introduction Page

View in site https://jaymushui.github.io/about/site#site-history-changelog

Frontend Toolchain

Core Frameworks

For custom modifications to the current framework, please see this section and subsequent chapters

Development Tools

  • ๐Ÿ“ฆ Package Manager: pnpm
  • โšก Build Tool: Vite
  • ๐Ÿ“˜ Development Language: TypeScript
  • ๐ŸŽจ Style Preprocessor: SCSS
  • โœจ Code Standards: ESLint + Prettier

Major Dependencies

Supported Deployment Platforms

Development Environment

  • ๐ŸŸข Runtime: Node.js
  • ๐Ÿ’ป Development IDE: VSCode
  • ๐Ÿ”„ Version Control: Git

Others

  • ๐Ÿ–ผ๏ธ Telegraph + Cloudflare Pages: Static Resource CDN Hosting ๐Ÿ”—
  • ๐Ÿ”— Related Projects:
  1. https://mushui.pages.dev/(Social Profile)[Not Open Source]
  2. ๐Ÿคซ

Markdown Article Frontmatter Field Guide (Source Code Reference)

Valaxy and this theme support the following frontmatter fields, all with source code references or official conventions for easy tracing and maintenance:

1. Basic Information Fields

  • title: Article title (Valaxy convention, supported by all components)
  • icon: Icon before title (YunPostCard.vue:27, Valaxy convention)
  • description: Article description (YunPostMeta.vue:22)
  • author: Author (YunPostMeta.vue:23)
  • date: Publication time (YunPostMeta.vue:20, Valaxy convention)
  • updated: Update time (YunPostMeta.vue:21, Valaxy convention)
  • path: Article path (Valaxy convention) โ“
  • abbrlink: Permanent link (Valaxy convention) โ“

2. Structure and Style Fields

  • toc: Whether to show table of contents (Valaxy convention)
  • aside: Whether to show right sidebar (Valaxy convention)
  • markdownClass: Custom Markdown style (Valaxy convention) โ“
  • pageTitleClass: Page title style (Valaxy convention) โ“
  • postTitleClass: Custom title style in article list (YunPostCard.vue:40)

3. Categories and Tags

  • categories: Categories (YunPostCard.vue:115, Valaxy convention)
  • tags: Tags (YunPostCard.vue:117, Valaxy convention)

4. Article Content and Excerpt (โ—Not preferred style)

  • excerpt: Custom excerpt (YunPostCard.vue:97, Valaxy convention)
  • excerpt_type: Excerpt type (YunPostCard.vue:96, Valaxy convention)
  • cover: Cover image (YunPostCard.vue:73, Valaxy convention)

5. Navigation and Sorting

  • nav: Whether to show article navigation (Valaxy convention)
  • top: Top priority (YunPostMeta.vue:30, Valaxy convention)
  • end: Whether finished (Valaxy convention)

6. Status and Permissions

  • draft: Whether draft (Valaxy convention)
  • hide: Whether hidden (Valaxy convention)
  • comment: Whether to show comments (Valaxy convention)
  • time_warning: Update time warning (Valaxy convention) โ— [Globally disabled]

7. Statistics and Reading

  • wordCount: Word count (YunPostMeta.vue:18, auto-generated)
  • readingTime: Reading time (YunPostMeta.vue:19, auto-generated)

8. Article Type and External Links โ“

  • type: Card type (YunPostCard.vue:26, Valaxy convention)
  • url: Override article URL, direct jump (YunPostCard.vue:103, Valaxy convention)

9. Images and Multimedia (โ—Not used)

  • image: Schema.org image object (Valaxy convention)
  • albums: Album array (Valaxy convention)
  • photos: Photo array (Valaxy convention)
  • medium_zoom: Whether to use medium-zoom image scaling (Valaxy convention)

10. Code and Math

  • katex: Whether to use KaTeX math formulas (Valaxy convention)
  • codepen: Whether to use CodePen (Valaxy convention)
  • codeHeightLimit: Code block height limit (Valaxy convention)

11. Encryption and Security (โ—Not used)

  • encrypt: Whether to enable encryption (Valaxy convention)
  • password: Encryption password (Valaxy convention)
  • password_hint: Password hint (Valaxy convention)
  • gallery_password: Album password (Valaxy convention)
  • encryptedContent: Encrypted content (Valaxy convention)
  • partiallyEncryptedContents: Partially encrypted content (Valaxy convention)
  • encryptedPhotos: Encrypted album (Valaxy convention)

12. Other Special Fields (โ—Not used)

  • from: Source path for client redirect (Valaxy convention)

Field Source Code Reference

  • YunPostMeta.vue, YunPostCard.vue, etc. are project custom component source files.
  • Valaxy convention indicates that the field is explicitly supported in Valaxy official themes, plugins, or documentation.
  • Auto-generated indicates that the field is automatically generated by Valaxy or related plugins, no need to manually fill in.

Usage Example (Version without cover and excerpt)

---
title: 
  zh-CN: ๆ ‡้ข˜
  en: title
icon: i-carbon-moon
color: green 
description: 
  zh-CN: ๆ่ฟฐ
  en: description
author: 
  zh-CN: ๆŽๆ˜Ž
  en: Li Ming
date: 2077-01-01 01:12:00
updated: 2080-04-18 01:12:00
toc: true
aside: true
tags:
  - {"zh-CN": "ๆ ‡็ญพ1", "en": "Tag1"}
  - {"zh-CN": "ๆ ‡็ญพ2", "en": "Tag2"}
categories:
  - {"zh-CN": "็ฑปๅž‹", "en": "categories"}
---

## ไพ‹ {lang=zh-CN}
## example {lang=zh-en}

::: zh-CN
ๆ–‡็ซ ๅ†…ๅฎน...
:::

::: en
The content of the article...
:::

<!-- more -->

::: zh-CN
ๆ–‡็ซ ๅ†…ๅฎน...
:::

::: en
The content of the article...
:::

Configuration File Options Guide

site.config.ts Site Configuration

  • ๐Ÿ  Basic Configuration

    • url: Complete site URL, used for generating article permanent links
    • lang: Site default language
    • title: Site title
    • subtitle: Site subtitle
    • description: Site description
    • timezone: Site timezone
    • languages: Optional language list
    • favicon: Site icon
    • lastUpdated: Whether to show last update time
  • ๐Ÿ‘ค Author Information

    • author.name: Author name
    • author.avatar: Author avatar
    • author.status: Status information (emoji and message)
    • author.intro: Personal introduction
    • author.email: Email
    • author.link: Personal homepage link
  • ๐Ÿ”— Social Links

    • social: Social platform link array, supports custom icons and colors
  • ๐Ÿ” Search Configuration

    • search.enable: Whether to enable search
    • search.type: Search type (fuse/algolia/engine)
    • fuse: fuse search configuration
  • ๐Ÿ’ฌ Comment System

    • comment.enable: Whether to enable comments
  • ๐Ÿ’ฐ Sponsor Configuration

    • sponsor.enable: Whether to enable sponsorship
    • sponsor.description: Sponsor description (supports multiple languages)
    • sponsor.methods: Sponsor method configuration
  • ๐Ÿ“Š Statistics Configuration

    • statistics.enable: Whether to enable statistics
    • statistics.readTime: Reading time configuration

theme.config.ts Theme Configuration

  • ๐ŸŽจ Theme Style

    • type: Theme type ('strato' or 'nimbo')
    • colors.primary: Theme color
    • valaxyDarkOptions: Dark mode configuration
  • ๐ŸŽฏ Homepage Configuration

    • banner: Homepage slogan configuration
    • bg_image: Background image configuration
  • ๐Ÿ’ญ Feature Modules

    • say: Say something configuration
    • notice: Notice configuration
    • fireworks: Click fireworks effect configuration
  • ๐Ÿ“ฑ Navigation Configuration

    • nav: Navigation bar configuration
    • pages: Page configuration
    • sidebar: Sidebar configuration
    • menu: Menu bar configuration
  • ๐Ÿ‘ฃ Footer Configuration

    • footer.since: Site creation time
    • footer.cloud: Footer cloud effect
    • footer.icon: Footer icon configuration
    • footer.powered: Whether to show Powered by
    • footer.beian: ICP filing information configuration
  • ๐Ÿ“ Article Configuration

    • types: Custom article card types
    • outlineTitle: Article table of contents title

Development Commands

๐Ÿš€ Basic Commands

# Install dependencies
pnpm i

# Development preview
pnpm dev

# Build (SSG version)
pnpm build

# Build (SPA version)
pnpm build:spa

# Build (SSG version, same as pnpm build)
pnpm build:ssg

# Generate RSS
pnpm rss

# Preview build results
pnpm serve

# Clean build files (custom command, implemented in scripts/clean.js)
# Deletes the following files:
# - public/feed.xml
# - public/atom.xml
# - public/feed.json
# - public/valaxy-fuse-list.json
# - dist/
pnpm clean

๐Ÿ”ง Development Tool Commands

# Code format check
pnpm lint

# Code formatting
pnpm format

# Type check
pnpm type-check

๐Ÿ“ฆ Dependency Management Commands

# Add dependency
pnpm add <package-name>

# Add development dependency
pnpm add -D <package-name>

# Update dependencies
pnpm update

# Remove dependency
pnpm remove <package-name>

๐Ÿงน Cleanup Commands

# Clean build cache
pnpm clean

# Clean dependencies
pnpm clean:all

๐Ÿ“ Other Commands

# Generate type declaration files
pnpm gen-types

# Run custom scripts
pnpm run <script-name>

๐Ÿ“Œ Command Description

  • pnpm i: Install all project dependencies, including development dependencies
  • pnpm dev: Start development server with hot reload
  • pnpm build: Build production code (SSG version), output to dist directory
  • pnpm build:spa: Build single page application version
  • pnpm build:ssg: Build static site version
  • pnpm rss: Generate RSS subscription file
  • pnpm serve: Preview built production code

โš ๏ธ Notes

  1. After first cloning the project, run pnpm i to install dependencies
  2. Use pnpm dev to start development server
  3. Make sure all code is saved before building
  4. If you encounter dependency issues, try deleting the node_modules directory and run pnpm i again

Directory Structure

๐Ÿ“ Core Directories

  • pages/: All page content
    • posts/: Blog articles
    • about/: About pages
  • components/: Custom Vue components
  • layouts/: Custom layout components
  • styles/: Custom style files
  • locales/: Internationalization language files
  • utils/: Utility functions
  • types/: TypeScript type declarations
  • setup/: Application initialization settings
  • stores/: Pinia state management
  • plugins/: Custom plugins
  • public/: Static resource files
  • dist/: Generated files after build

๐Ÿ“„ Configuration Files

  • site.config.ts: Site configuration
  • theme.config.ts: Theme configuration
  • valaxy.config.ts: Valaxy framework configuration
  • tsconfig.json: TypeScript configuration
  • package.json: Project dependency configuration
  • pnpm-lock.yaml: Dependency version lock file

๐Ÿ”ง Development Tool Configuration

  • .vscode/: VSCode editor configuration
  • .github/: GitHub Actions workflow configuration
  • .editorconfig: Editor common configuration
  • .npmrc: NPM configuration
  • .gitignore: Git ignore file configuration

๐Ÿš€ Deployment Configuration

  • .github/: Github deployment configuration
  • vercel.json: Vercel deployment configuration
  • netlify.toml: Netlify deployment configuration
  • nginx.conf: Nginx server configuration
  • Dockerfile: Docker container configuration
  • .dockerignore: Docker ignore file

๐Ÿ“ฆ Build Output

  • .valaxy/: Valaxy build cache
  • node_modules/: Dependency package directory

๐Ÿ“ Others

  • scripts/: Custom scripts
  • config/: Other configuration files

RSS Auto-generation Disabling Measures for Valaxy 0.23.4 Release

If RSS functionality is not needed, or to avoid RSS generation errors due to multilingual frontmatter, you can disable RSS auto-generation in the following way:

  1. Open the file node_modules/.pnpm/valaxy@0.23.4_.../node_modules/valaxy/dist/chunk-OXTCPOR5.js.
  2. Search for rssModule or build:after, find the following code:
    setup(node) {
      node.hook("build:after", async () => {
        //console.log();
        //await build(node.options);
        return;
      });
    }
  3. Comment out await build(node.options); or directly return;, so RSS files won't be automatically generated during build.

Note: This file will be overwritten after each valaxy dependency upgrade, requiring reoperation.

Custom .ts Functions (utils/types folder)

i18n.ts [๐Ÿ“ utils] ๐Ÿ”—

  • Function: Parse multilingual content, supporting object and string forms.
  • Usage:
    parseI18nContent({ 'zh-CN': 'Chinese', 'en': 'English' }) // Returns content corresponding to current language
    parseI18nContent('Plain text') // Returns string directly

formatTimestamp.ts [๐Ÿ“ utils] ๐Ÿ”—

  • Function: Format timestamp or date object to 'YYYY-MM-DD HH:mm:ss' format.
  • Usage:
    formatTimestamp(new Date()) // Returns formatted string of current time

shims.d.ts [๐Ÿ“ types] ๐Ÿ”—

  • Function: TypeScript type declaration file for extending module type definitions.
  • Main Purpose:
    1. Declare module types for .yml and .yaml files
    2. Provide type support for Vue I18n
    3. Ensure TypeScript can correctly identify and type check YAML format language files
  • Usage Scenarios:
    • When project uses Vue I18n for internationalization
    • When using YAML files to store configuration or language files
    • When TypeScript support is needed for these file types
  • File Content:
    declare module '*.yml' {
      import { DefineLocaleMessage } from 'vue-i18n';
      const messages: DefineLocaleMessage;
      export default messages;
    }
    
    declare module '*.yaml' {
      import { DefineLocaleMessage } from 'vue-i18n';
      const messages: DefineLocaleMessage;
      export default messages;
    }

Custom Layout Components (layouts folder)

404.vue [๐Ÿ“ layouts] ๐Ÿ”—

  • Function: Display 404 error page with fun multilingual recipe display feature.
  • Main Features:
    1. Multilingual Support: Provides recipe content in Simplified Chinese, Traditional Chinese, English, and Japanese
    2. Dynamic Switching: Supports dynamic switching display of recipe content in different languages
    3. Style Optimization:
      • Add shadow effect to 404 numbers
      • Custom button style with hover effect
      • Optimize recipe content layout and spacing

categories.vue [๐Ÿ“ layouts] ๐Ÿ”—

  • Function: Category page layout, supporting multilingual category display and management.
  • Main Features:
    1. Multilingual Support:
      • Integrates parseI18nContent utility function
      • Optimizes category name display logic
    2. Category Filtering:
      • Supports object-form category data
      • Optimizes URL parameter handling
    3. Category Merging:
      • Implements multilingual category merge display
      • Optimizes category count statistics
    4. Page Optimization:
      • Adds transition animation effects
      • Improves category list display method

tags.vue [๐Ÿ“ layouts] ๐Ÿ”—

  • Function: Tag page layout, supporting multilingual tag cloud display.
  • Main Features:
    1. Multilingual Support:
      • Integrates parseI18nContent utility function
      • Optimizes tag name display logic
    2. Tag Style System:
      • Dynamically calculates font size based on usage frequency
      • Implements tag color gradient effect
      • Uses TinyColor library for color mixing
    3. Tag Filtering:
      • Supports object-form tag data
      • Improves URL parameter handling
    4. Tag Merging:
      • Implements multilingual tag merge display
      • Optimizes tag count statistics
    5. Page Optimization:
      • Adds transition animation effects
      • Optimizes tag cloud layout
      • Supports responsive design

Custom SCSS Styles (styles folder)

index.scss [๐Ÿ“ styles] ๐Ÿ”—

  • Function: Define sidebar background image and dark mode styles.
  • Usage:
    // Sidebar background image style
    .yun-fullscreen-menu {
      position: relative;
      
      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
        background-image: url('https://cloudflare-imgbed-telegraph.pages.dev/file/MTYW_Nobi_With_Mu_20250514.webp');
        background-position: bottom 0rem center;
        background-size: contain;
        background-repeat: no-repeat;
        opacity: 0.4;
        transition: all 0.3s ease;
      }
    }
    
    // Dark mode style
    html.dark {
      .yun-fullscreen-menu {
        &::before {
          background-image: url('https://cloudflare-imgbed-telegraph.pages.dev/file/MTYW_Onocle_CardGame_Mu_20250527.webp');
          opacity: 0.8;
        }
      }
    }

Setup Folder

Purpose

The setup folder is used to store application initialization settings files, mainly for configuring Google Analytics tracking and other application-level settings.

Included Files

  • main.ts [๐Ÿ“ setup] ๐Ÿ”—: Main application settings file, used for initializing application and installing Google Analytics tracking.
  • gtag.ts [๐Ÿ“ setup] ๐Ÿ”—: Google Analytics tracking settings, used for installing Google Analytics on client side and tracking routes.

Custom Feature Components (components folder)

1. Multilingual Support Components

These components are mainly used to support multilingual frontmatter for Markdown articles, implemented through the parseI18nContent utility function:

  • YunPostCard.vue [๐Ÿ“ components] ๐Ÿ”—: Article card component, supports multilingual title and content display
  • YunPostCategories.vue [๐Ÿ“ components] ๐Ÿ”—: Article category component, supports multilingual category names
  • YunPostTags.vue [๐Ÿ“ components] ๐Ÿ”—: Article tag component, supports multilingual tag names
  • YunPostMeta.vue [๐Ÿ“ components] ๐Ÿ”—: Article metadata component, supports multilingual description and author information
  • YunNavMenuTitle.vue [๐Ÿ“ components] ๐Ÿ”—: Navigation menu title component, supports multilingual display
  • YunCategory.vue [๐Ÿ“ components] ๐Ÿ”—: Category component, supports multilingual category names
  • YunCategoryChildItem.vue [๐Ÿ“ components] ๐Ÿ”—: Subcategory component, supports multilingual display
  • YunPostNav.vue [๐Ÿ“ components] ๐Ÿ”—: Article navigation component, supports multilingual
  • YunPostsInfo.vue [๐Ÿ“ components] ๐Ÿ”—: Article information component, supports multilingual display
  • YunPostCollapseItem.vue [๐Ÿ“ components] ๐Ÿ”—: Article collapse item component, supports multilingual content

2. Statistics and Monitoring Components

These components are used for website access statistics and runtime display:

  • YunPostMeta.vue [๐Ÿ“ components] ๐Ÿ”—:

    • Integrates Busuanzi page view statistics
  • YunFooter.vue [๐Ÿ“ components] ๐Ÿ”—:

    • Displays website runtime (counted from deployment)
    • Integrates Busuanzi total site access statistics

3. Feature Components

These components provide website features:

  • YunBanner.vue [๐Ÿ“ components] ๐Ÿ”—: Banner component, customizes animation display time, optimizes user experience
  • YunSay.vue [๐Ÿ“ components] ๐Ÿ”—: Say something component, integrates Google Translate API for automatic translation of hitokoto content, supports multilingual display
  • YunNotice.vue [๐Ÿ“ components] ๐Ÿ”—: Notice component, supports custom multilingual notice content in configuration file
  • YunSponsor.vue [๐Ÿ“ components] ๐Ÿ”—: Sponsor component, supports custom multilingual sponsor description in configuration file

4. Layout and Navigation Components

These components are used for website overall layout and navigation, all integrated with multilingual support:

  • YunLayoutPostTag.vue [๐Ÿ“ components] ๐Ÿ”—: Tag cloud layout component, supports dynamic style calculation
  • YunNavMenuItem.vue [๐Ÿ“ components] ๐Ÿ”—: Navigation menu item component, supports multilingual display
  • YunPageHeader.vue [๐Ÿ“ components] ๐Ÿ”—: Page title component, supports multilingual title
  • YunSidebarLinks.vue [๐Ÿ“ components] ๐Ÿ”—: Sidebar links component, supports multilingual link text
  • YunPrologueSquare.vue [๐Ÿ“ components] ๐Ÿ”—: Prologue square component, supports multilingual content

5. Configuration Related Notes

  • Supports custom multilingual configuration in site.config.ts [๐Ÿ“ root] ๐Ÿ”— and theme.config.ts [๐Ÿ“ root] ๐Ÿ”—:
    • Notice module: Supports multilingual notice content
    • Sponsor module: Supports multilingual sponsor description
  • Uses as any type assertion solution to ensure functions correctly read multilingual configuration

Multilingual Configuration Notes

For current valaxy 0.23.4 release Due to valaxy official type declaration limitations, site.config.ts [๐Ÿ“ root] ๐Ÿ”— and theme.config.ts [๐Ÿ“ root] ๐Ÿ”— need to use as any type assertion for multilingual objects (like sponsor.description, notice.content), otherwise type errors will occur.

Example

// site.config.ts
sponsor: {
  enable: true,
  description: {
    'zh-CN': 'ๆˆ‘ๆ˜ฏๅญฆ็”Ÿ็ป™ๆˆ‘้’ฑ๏ผˆๆฒกๆœ‰่ฏด็คผ่ฒŒ็š„ๆ„ๆ€๏ผ‰',
    'en': 'Student here, send moneyโ€”โ€” no cap'
  } as any,
  // ...
}

// theme.config.ts
notice: {
  enable: true,
  hideInPages: false,
  content: {
    'zh-CN': 'โ€ป็ฝฎ้กถ๏ผš Who am I ? |  (UTC+8)2025-03-06 14:27:19',
    'en': 'โ€ปPinned: Who am I ? |  (UTC+8)2025-03-06 14:27:19'
  } as any,
}

Explanation

  • This is because valaxy official type declarations only support string type for description/content, cannot directly pass objects.
  • Using as any can bypass type checking, no problems in actual runtime.
  • If official type declarations upgrade to support object types, can remove as any.
  • All components integrate parseI18nContent utility function [๐Ÿ“ utils] ๐Ÿ”— for handling multilingual content
  • Supports using object form to define multilingual content in frontmatter:
    title:
      zh-CN: ไธญๆ–‡ๆ ‡้ข˜
      en: English Title
    description:
      zh-CN: ไธญๆ–‡ๆ่ฟฐ
      en: English Description

๐Ÿ“ ToDo List

๐Ÿšง Features to Optimize

  1. Multilingual Real-time Switch Optimization

    • Tag cloud component (YunLayoutPostTag.vue) multilingual real-time response
    • Category page article list multilingual real-time switch
    • Tag page article list multilingual real-time switch
    • Optimize i18n.ts utility function support for complex components
  2. Multilingual Framework Extension

    • Not understanding how valaxy framework itself supports more than two languages
    • Complete language support in locales directory (reserved corresponding key files):
      • Traditional Chinese (zh-TW) support
      • Japanese (ja) support
    • Design multilingual switch user interface
  3. Local Search Strategy Issues

  • The local search strategy of the fuse.js solution is not suitable for the current multilingual frontmatter articles.
  • Issues such as being unable to search for detailed article content may occur on the built website, etc.