返回

hugo 目录详细说明

官方文档你能再简省一点吗(恼

文件目录总览

my-site/
├── archetypes/             模板
├── assets/                 组件
├── content/                内容
├── data/                   数据
├── i18n/                   语言
├── layouts/                页面
├── static/                 静态资源
├── themes/                 主题
└── hugo.toml/yaml/json     配置文件
---public/                  发布的文件夹

archetypes

里面存放着简单的模板,利用命令创建文件的时候就会利用上里面的模板。

assets

里面存放着为数众多的站点的相关资源文件,包括但不限于图标、头像、三方组件的图像、scss(页面主题相关的 css)、ts(typescript?)

其中友链的相关头像,站点里你的头像(*注:不是ico,是 avatar.png),就放在 /link-img 与 img 下

content

你的博客文件就在这里

content/
├── categories/             目录
├   ── category1/
├   ├    ├──_index.md  //**不**可以重命名
├   ├    └──photo1.png //md 文件可能引用的图片
├   └── category2/
├── page/                   左边栏
├   ── name1/
├   ├   ├── file1/
├   ├       └──index.md //**不**可以重命名
├   └── name2/
├── post/                   文章存放
├   ├── year1/
├   ├   ├── file1/
├   ├       ├──_index.md  //可以重命名
├   ├       └──photo1.png //md 文件可能引用的图片
├   ├   ├── file2/
├   ├       ├──_index.md 
├   ├       └──photo.png 
├   └── year2/
├    
└── tag/                    标签(尚未探索)

有几点说明:

  • 你的文章的页首请记住加上 “slug”, 它会是这篇文章的永久目录所在地。

  • 不要去重命名 index 和 _index ,会变得不幸

  • md 文件中如果要引用同目录下的文件,目录应该这么填写,因为其渲染出来之后是位于另一个文件夹的。

    ../../post/(year)/(md 的 slug)/yourimgname.png

  • comments 属性不要出现,目前只要出现评论模块就消失

  • draft 属性建议常态设置为 false,毕竟都是本地推上去的。

  • 本地推上去,是先在本地进行修改,然后结束之后选择

    --> rm -r public/
    --> hugo 
    --> git add public/ 
    --> git commit -m "update something" 
    --> git push --force origin 
    --> go to server and use "git clone git@github.com:yourname/repo"
    --> mv public ..
    

    如果选择pull遇到冲突就选择接收外界的然后 git add and git commit -m "fix error"

  • md 文件的文件头的信息可以去官网查询,一般来说给的 default 就基本够用了。

data

这里目前就是存放友链的 json 文件配置的地方。

i18n

多国语言支持,暂未研究。

layouts

页面的结构组织的配件,由 index.html 发起引用,最终递归调用拼出 public 中的 index.html

stastic (后加)

静态资源,编译出来在 public 的根目录。

thmems

别动(

config.yaml/htom/json

配置文件

(挖坑待补)

长夜如此温柔,我该用什么把你留住


© Licensed Under CC BY-NC-SA 4.0


蜀ICP备2024113293号