Skip to content

Cover Image

The cover image configuration controls post cover display and random cover image functionality.

Config File

src/config/coverImageConfig.ts

Properties

PropertyTypeDefaultDescription
enableInPostbooleantrueShow cover image on post detail pages
randomCoverImage.enablebooleanfalseEnable random cover image
randomCoverImage.apisstring[]-Random image API list
randomCoverImage.fallbackstring"assets/images/cover.avif"Fallback image when APIs fail
randomCoverImage.showLoadingbooleanfalseShow loading animation

Example

ts
export const coverImageConfig: CoverImageConfig = {
  enableInPost: true,
  randomCoverImage: {
    enable: false,
    apis: [
      "https://t.alcy.cc/pc",
      "https://www.dmoe.cc/random.php",
    ],
    fallback: "assets/images/cover.avif",
    showLoading: false,
  },
};

Using Random Cover Images

Set image to "api" in your post's frontmatter:

yaml
---
title: Post Title
image: "api"
---

The system will try each configured API in order, falling back to the fallback image if all fail.