Hugo-theme-yinyang 使用教程

Hugo-theme-yinyang 使用教程

hugo-theme-yinyang A black-white theme for Hugo. hugo-theme-yinyang 项目地址: https://gitcode.com/gh_mirrors/hu/hugo-theme-yinyang

1. 项目介绍

Hugo-theme-yinyang 是一款为 Hugo 框架设计的简洁黑白主题。它具有以下特点:

  • 简约风格
  • 多语言支持
  • Disqus 支持
  • SEO 优化

2. 项目快速启动

克隆项目

首先,从你的站点的根目录执行以下命令来克隆主题:

git clone git@github.com:joway/hugo-theme-yinyang.git themes/yinyang

修改配置文件

接着,修改你的 config.toml 文件,设置主题为 yinyang

theme = "yinyang"

配置语言

对于多语言支持,你需要在 config.toml 文件中配置语言设置:

[languages]
[languages.en]
contentDir = "content/en"
languageName = "English"
weight = 1

[languages.cn]
contentDir = "content/cn"
languageName = "Chinese"
weight = 2

确保你的文章放在相应的语言目录中,例如 content/encontent/cn

示例配置

以下是一个基本的 config.toml 配置示例:

baseURL = "https://你的域名/"
languageCode = "zh-CN"
title = "你的博客名称"
theme = "yinyang"
DefaultContentLanguage = "zh"

[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true

[markup.highlight]
guessSyntax = true
noClasses = true
style = "bw"
tabWidth = 2

[author]
name = "你的名字"
homepage = "你的个人网站"

[params]
mainSections = ["posts"]
headTitle = "你的网站标题"
disqus = "你的Disqus账户名"
extraHead = '<script async src="https://www.googletagmanager.com/gtag/js?id=你的Google Analytics ID"></script>'

[[params.socials]]
name = "关于我"
link = "https://你的个人网站"

[[params.socials]]
name = "GitHub"
link = "https://github.com/你的GitHub用户名"

postHeaderContent = ""
postFooterContent = "<br/><br/><p>订阅:<a target='_blank' href='你的订阅链接'>你的博客名称</a></p>"

3. 应用案例和最佳实践

网站标题和副标题

params 部分设置 headTitle 可以定义网站的标题。

社交媒体链接

params 部分添加 socials 可以在页脚显示社交媒体链接。

订阅信息

params 部分设置 postFooterContent 可以在每篇文章底部添加订阅信息。

4. 典型生态项目

Hugo 生态中有许多插件和项目可以与 hugo-theme-yinyang 主题配合使用,例如:

请注意,以上只是示例,实际使用时需要根据具体需求选择合适的项目。

hugo-theme-yinyang A black-white theme for Hugo. hugo-theme-yinyang 项目地址: https://gitcode.com/gh_mirrors/hu/hugo-theme-yinyang

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农彩媛Louise

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值