当前位置: 首页 > news >正文

Hugo·Stack主题·使用及修改

代码折叠

image-20230826113433972

image-20230826113359372

cp themes/hugo折-themt-saick/exampleSlte/config.yamsclass="codefold"><summary class="codefold__title"><span class="codefold__title-text">" {{ with .Get 0}}{{.}}{{else}}click to expand{{ end }} "</span></summary>{{ .Inner }}
</details><!-- 样式 -->
<style>.codefold {margin: 1.5em 0;border: 1px solid #e9edf3;/* overflow: hidden; */waline:serverURL:lang:pageview:emoji:- https://unpkg.com/@waline/emojis@1.0.1/weiborequiredMeta:- name- email- urllocale:admin: Adminplaceholder:twikoo:envId:region:path:lang:# See https://cactus.chat/docs/reference/web clien{/#configuration for d
scrip ion of the various options    padding: 0.5em 1em;cursor: pointer;siteName: "" # You must insert a unique identiuier here matching the see you regisrered (See https://cactus.chat/docs/getting-started/queck-start/#register-your-site)giscus:repoct        ropoID:; background-color: #f6f8fa;shqu }.rtname bodere using
o_squsShortnamt: hugoleh-text {cactus:defaultHomeserverUrl: "https://matrix.cactus.chat:8448"serverName: "cactus.chat"homepage:- type: search- type: archivesparams:limit: 5- type: categoriesparams:category:categoryID:mapping:lightTheme:darkTheme:reactionsEnabled: 1emitMetadata: 0gitalk:owner:admin:repo:clientID:clientSecret:cusdis:host:id:widgets:font-size: 1.2em;limit: 10- type: tag-cloudparams:limit: 10page:- type: tocopengraph:twitter:# Your Twitter usernamesite:# Available values: summary, summary_large_imagecard: summary_large_imagedefaultImage:opengraph:enabled: falselocal: falsesrc:colorScheme:# Display toggletoggle: true# Available values: auto, light, darkdefault: autoimageProcessing:cover:enabled: truecontent:enabled: true### Custom menu
### See http.c://dos[image-20230826121716126](https://img-blog.csdnimg.cn/img_convert/e65d35837921044d2109b043d8dcd60d.png)```scssmenu item, remove `menu` field from their FrontMatter
menu:main: []social:- identifier: githubname: GitHuburl: https://github.com/Shadow-Kylin/Shadow-Kylin.github.ioparams:icon: brand-github# - identifier: twitter#   name: Twitter#   url: https://twitter.com#   params:#       icon: brand-twitterrelated:includeNewer: truethreshold: 60toLower: falseindices:- name: tagsweight: 100- name: categoriesweight: 200markup:goldmark:renderer:## Set to true if you have HTML content inside Markdownunsafe: truetableOfContents:endLevel: 6ordered: truestartLevel: 1highlight:noClasses: falsecodeFences: trueguessSyntax: truelineNoStart: 1lineNos: truelineNumbersInTable: truetabWidth: 4

修改内容区

cp -r ./themes/hugo-theme-stack/exampleSite/content/categories ./content
cp -r ./themes/hugo-theme-stack/exampleSite/content/page ./content
cp -r ./themes/hugo-theme-stack/exampleSite/content/_index.zh-cn.md ./content

运行

运行 hugo server

初始样子

修改配置和添加文章后的样子

屏幕截图 2023-08-26 082328

文章位置

主题默认在主页输出 content/post 目录下的内容,应该在那个目录新建文章。

注意,Hugo 官方文档入门教程里面是在 content/posts 目录新建文章。

image-20230826082815086

左侧菜单项目

主页,关于,归档,搜索,链接等页面在 content/page/ 目录中有对应的目录。

image-20230826082903271

把对应目录中的 index.md 复制为 index.zh-cn.md, 然后将 index.zh-cn.md 的 front matter 中的 title 修改成对应的中文标题就让侧边栏显示成中文。

image-20230826082948694

主题中的图标

主题自带一些来自 Tabler Icons的图标,它们放在 themes/hugo-theme-stack/assets/icons/ 目录中。

如果要使用自定义图标,把它们放在 assets/icons/ 目录。

front matter是什么:

image-20230825183824457

文章封面

在 front matter 中通过 image 属性定义要使用的封面图片。

image: hugo-logo-wide.svg

这个封面图片放在哪儿?

image-20230825191923124

或者我们封面使用外链也可以。

滚动条样式

themes/hugo-theme-stack/assets/scss/partials/base.scss

导入字体

themes/hugo-theme-stack/assets/scss/style.scss

@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-lite-webfont@1.1.0/style.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/cascadia-code@4.2.1/index.min.css');

修改字体

themes/hugo-theme-stack/assets/scss/variables.scss

:root {--sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue";--zh-font-family: "PingFang SC", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei";--base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family), sans-serif;--code-font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

代码折叠

image-20230826113433972

image-20230826113359372

<!-- 折叠代码 --><details class="codefold"><summary class="codefold__title"><span class="codefold__title-text">" {{ with .Get 0}}{{.}}{{else}}click to expand{{ end }} "</span></summary>{{ .Inner }}
</details><!-- 样式 -->
<style>.codefold {margin: 1.5em 0;border: 1px solid #e9edf3;/* overflow: hidden; */background-color: #f6f8fa;}.codefold__title {padding: 0.5em 1em;cursor: pointer;user-select: none;background-color: #f6f8fa;}.codefold__title-text {flex: 1;font-size: 1.2em;font-weight: 600;color: rgb(215, 178, 130);text-decoration: 2px underline;}.codefold_tip {font-size: 1.2em;font-weight: 600;color: #6280ad;}
</style><!-- 使用格式双括号 百分号 codefold 标题 百分号 双括号代码双括号 百分号 /codefold 百分号 双括号-->

友链三栏

在下面文件夹中的custom.scss中添加后面代码。

@media (min-width: 1024px) {.article-list--compact.links {display: grid;grid-template-columns: 1fr 1fr 1fr;//三栏background: none;box-shadow: none;article {background: var(--card-background);border: none;box-shadow: var(--shadow-l2);margin-bottom: 8px;border-radius: 10px;&:nth-child(odd) {//奇数margin-right: 8px;}}}
}

成果

影麟

上面博客里的大部分图片都存在了Github,所以你们可能会获取失败。

参考文章

墨语-Hugo Stack 主题使用方法

建站技术 | 使用 Hugo+Stack 简单搭建一个博客——失迹の博客

(1)带着Stack主题入坑Hugo

http://www.lryc.cn/news/140687.html

相关文章:

  • 实战:大数据Spark简介与docker-compose搭建独立集群
  • 嵌入性视角下的企业集成创新网络演化过程
  • 回归预测 | MATLAB实现FA-ELM萤火虫算法优化极限学习机多输入单输出回归预测(多指标,多图)
  • 数据结构数组栈的实现
  • 成集云 | 抖店连接器客户静默下单催付数据同步钉钉 | 解决方案
  • 【算法专题突破】双指针 - 复写零(2)
  • 【Java从0到1学习】11 Java集合框架
  • uniapp使用uni.chooseLocation()打开地图选择位置
  • 学习笔记|课后练习解答|电磁炉LED实战|逻辑运算|STC32G单片机视频开发教程(冲哥)|第八集(下):课后练习分析与解答
  • 前端高频面试题 js中堆和栈的区别和浏览器的垃圾回收机制
  • 自然语言处理:大语言模型入门介绍
  • 使用秘籍|如何实现图数据库 NebulaGraph 的高效建模、快速导入、性能优化
  • 对于pycharm 运行的时候不在cmd中运行,而是在python控制台运行的情况,如何处理?
  • Spring MVC 二 :基于xml配置
  • springboot aop方式实现接口入参校验
  • 解决git上传远程仓库时的大文件提交
  • HTML学习笔记02
  • <C++> 内存管理
  • 【Java】ByteBuffer类的arrayOffset方法详解+示例
  • 【C++】C++ 引用详解 ⑤ ( 函数 “ 引用类型返回值 “ 当左值被赋值 )
  • Git,分布式版本控制工具
  • LeetCode 面试题 02.02. 返回倒数第 k 个节点
  • SpeedBI数据可视化工具:丰富图表,提高报表易读性
  • 编写Dockerfile制作Web应用系统nginx镜像
  • 记录一次微服务连接Nacos异常-errorMsg: Illegal character in authority at index 7:
  • 【Java】反射 之 调用构造方法
  • Hightopo 使用心得(6)- 3D场景环境配置(天空球,雾化,辉光,景深)
  • 【Python PEP 笔记】201 - 同步迭代 / zip() 函数的使用方法
  • 远程控制:用了向日葵控控A2后,我买了BliKVM v4
  • 基于swing的火车站订票系统java jsp车票购票管理mysql源代码