時間:2023-06-12 00:00:01 | 來源:網(wǎng)站運營
時間:2023-06-12 00:00:01 來源:網(wǎng)站運營
學(xué)習(xí)HUGO ,詳解目錄結(jié)構(gòu):HUGO 是一套模版靜態(tài)化的系統(tǒng),了解其目錄結(jié)構(gòu)有助于創(chuàng)建我們的網(wǎng)站系統(tǒng)Hyde
主題為例,完整的目錄結(jié)構(gòu)如下:iChochy├── archetypes 內(nèi)容模版目錄│ └── default.md 模版文件├── config.toml 配置文件├── content 內(nèi)容目錄├── data 數(shù)據(jù)目錄├── layouts 網(wǎng)站模版目錄├── static 靜態(tài)文件目錄└── themes 主題目錄 └── hyde Hyde主題目錄 ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── archetypes 內(nèi)容模版 │ └── default.md ├── go.mod ├── images │ ├── screenshot.png │ └── tn.png ├── layouts 網(wǎng)站模版 │ ├── 404.html 404面目模版 │ ├── _default 默認(rèn)模版目錄 │ │ ├── baseof.html 基礎(chǔ)模版 │ │ ├── list.html 列表頁面模版 │ │ └── single.html 單頁面模版 │ ├── index.html 首頁模版 │ └── partials 模塊模版目錄 │ ├── head.html HEAD模塊模版 │ ├── head_fonts.html │ ├── hook_head_end.html │ └── sidebar.html ├── static 靜態(tài)目錄 │ ├── apple-touch-icon-144-precomposed.png │ ├── css │ │ ├── hyde.css │ │ ├── poole.css │ │ ├── print.css │ │ └── syntax.css │ └── favicon.png └── theme.toml 主題配置文件
hugo new
命令創(chuàng)建新的內(nèi)容文件default.md
內(nèi)容模版---title: "{{ replace .Name "-" " " | title }}"date: {{ .Date }}categories: - iChochytags: - iChochy---
使用命令:hugo new posts/iChochy.md
,生成內(nèi)容文件 content/posts/iChochy.md
---title: "iChochy"date: 2020-08-10T18:13:25+08:00 categories: - iChochy tags: - iChochy ---
# 基礎(chǔ)參數(shù),通過.Site.xxxx獲取參數(shù)# 網(wǎng)站標(biāo)題title = "回憶中的明天"# 域名地址baseURL = "https://ichochy.com/"# 主題名稱theme = "hyde"# 網(wǎng)站的語言代碼languageCode = "zh_CN"# 啟用以將相對URL變?yōu)榻^對URLcanonifyURLs = false# Hugo 生成靜態(tài)站點的目錄publishDir = "docs"# 啟用生成robots.txt文件enableRobotsTXT = false# 啟用自動檢測內(nèi)容中的中文/日語/韓語,讓.Summary和.WordCount對于CJK語言正確運行hasCJKLanguage = false# 指定.Summary 的長度summaryLength = 70# 默認(rèn)分頁數(shù)paginate = 10# 啟用.html后綴地址,默認(rèn)URL為/filename/,啟用為/filename.htmluglyurls = false# 自定義參數(shù),通過.Site.Params.xxxx獲取參數(shù)[params] postDir = "posts" layoutReverse = false copyright = "iChochy" description = "碼農(nóng)小站,寫點Java、Swift和感悟"# 菜單參數(shù),通過.Site.Menus.main獲取參數(shù)# Name為菜單名稱、Weight為菜單排序參數(shù)、URL為菜單名稱[Menus] main = [ {Name = "Categories", Weight = 1, URL = "/categories/"}, {Name = "Tags", Weight = 2, URL = "/tags/"}, {Name = "Links", Weight = 3, URL = "/links/"}, {Name = "About", Weight = 4, URL = "/about/"}, {Name = "Feedback", Weight = 5, URL = "/feedback/"} ]
MD
源文件,通過對應(yīng)的模版生成靜態(tài)文件YAML
,JSON
或TOML
格式編寫數(shù)據(jù)文件,可用.Site.Data.xxxx
的方式來獲取數(shù)據(jù).html
文件形式存儲模板,這些模板指定如何將內(nèi)容目錄中的源文件呈現(xiàn)到靜態(tài)網(wǎng)站中CNAME
文件等關(guān)鍵詞:目錄,結(jié)構(gòu),學(xué)習(xí)
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。