Hugo建站与主题配置

将 GitHub Pages 配置为使用 Hugo 主题 PaperMod,需要以下步骤: 1. 安装和配置 Hugo 如果尚未安装 Hugo,先完成以下操作: 安装 Hugo 在 macOS 上:brew install hugo 在其他平台上,请根据 Hugo 官方文档 安装。 初始化 Hugo 项目 1 2 hugo new site my-website cd my-website 2. 添加 PaperMod 主题 将 PaperMod 主题添加到你的 Hugo 项目中: 克隆主题 在项目根目录运行: 1 2 git init git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/hugo-PaperMod 编辑配置文件 在项目根目录的 config.toml 中设置主题: 1 theme = "hugo-PaperMod" 配置主题参数 PaperMod 提供丰富的配置选项,可根据需求编辑 config.toml 文件。以下是一个示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 baseURL = "https://yourusername.github.io" languageCode = "en-us" title = "My Hugo Website" theme = "hugo-PaperMod" [params] defaultTheme = "auto" # 主题模式 (auto, light, dark) showReadingTime = true showWordCount = true disableSearch = false [menu] [[menu.main]] name = "Home" url = "/" weight = 1 [[menu.main]] name = "About" url = "/about/" weight = 2 3. 添加内容 使用 Hugo 创建内容,例如: ...

2010年1月4日 · 2 分钟 · 310 字 · wellzhi