Cover image source: Source
This blog template is built with Astro. For the things that are not mentioned in this guide, you may find the answers in the Astro Docs.
Front-matter of Posts
---
title: My First Blog Post
published: 2023-09-09
description: This is the first post of my new Astro blog.
image: ./cover.jpg
tags: [Foo, Bar]
category: Front-end
draft: false
---
Attribute | Description |
---|---|
title | The title of the post. |
published | The date the post was published. |
description | A short description of the post. Displayed on index page. |
image | The cover image path of the post. 1. Start with http:// or https:// : Use web image2. Start with / : For image in public dir3. With none of the prefixes: Relative to the markdown file |
tags | The tags of the post. |
category | The category of the post. |
draft | If this post is still a draft, which won’t be displayed. |
Where to Place the Post Files
Your post files should be placed in src/content/posts/
directory. You can also create sub-directories to better organize your posts and assets.
src/content/posts/
├── post-1.md
└── post-2/
├── cover.png
└── index.md
使用记录
md文件导入图片的时候可能会报 module not found …
解决:把第一张图片 例如

改为,等前端刷新一下再改回去就好了

添加nofollow标签(可选):如果你不确定外部网站的质量,或者不想传递SEO权重,可以添加rel=“nofollow”属性。例如:
html 复制 官方案例地址 运行 HTML 这告诉搜索引擎不要追踪该链接,也不会传递权重。
在 Categories.astro里过滤类别
const categories = await getCategoryList()
// 换为
const categories = (await getCategoryList()).filter(c => c.name !== 'Uncategorized')
或者注释掉这里 content-utils.ts
if (!post.data.category) {
// const ucKey = i18n(I18nKey.uncategorized)
// count[ucKey] = count[ucKey] ? count[ucKey] + 1 : 1
return
}
仍可以通过直接访问 http://localhost:4321/archive/category/uncategorized/ 获得未分类blogs. 注意uncategorized分类仅在本地能够显示出来,实际服务器环境下不知道为啥不能访问也看不到,会报404
在config.ts
里注释掉不希望展示出来的隐藏页面,可以通过 http://localhost:4321/shop/ 访问
export const navBarConfig: NavBarConfig = {
links: [
LinkPreset.Home,
LinkPreset.Archive,
LinkPreset.About,
// LinkPreset.Shop, // 添加在这里,就可以显示在主页面上了
LinkPreset.Blogroll,
{
name: 'GitHub',
url: 'https://github.com/teapot-4l8', // Internal links should not include the base path, as it is automatically added
external: true, // Show an external link icon and will open in a new tab
},
],
}
在Friend里,希望鼠标滑过某个人头的时候播放一小段音频作为彩蛋 总是需要在页面ctrl shift r强制刷新一次才会加载音频
在 Layout.astro界面有