Hugo
- 直接从hugo releases下载安装hugo_extended版本(否则出现
you need the extended version to build SCSS/SASS错误),然后将解压exe文件路径添加到环境变量即可 - 如果从代码托管平台下载工程,需要注意用
git clone --recursive xxx(否则theme文件不会自动下载)
文件目录结构
- 参考gohugo: Directory Structure
- 直接使用html的方法,参考这里
- 直接原样放到static目录中,hugo不套用(可以套用?)主题直接渲染
- 放在content目录相应分类文件夹中,(如果不在layout中自定义规则?)会根据当前主题渲染;如果不添加front matter,和放到static目录中结果一样
一些常用的命令
|
|
自定义模板
-
使用Go语言
print "foo" "bar"连接字符串输出"foobar"
-
示例如:插入图片可以用如下shortcode
1img src="/images/xxx.jpg" title="Sample Image" caption="Image with title, caption, alt, ..." alt="image alt" width="700px" position="center" attr="(src)" attrlink="link_for_attr"
zzo模板
插入$\KaTeX$数学公式
-
注意在fronter中的
libraries中添加katex,示例如下:
行内变量$x$以及行内公式$\sqrt{x^2+\sin(y)}$,行间公式如下:
$$ \texttt{myvalue}=\sum_{i} \sin(x^2) \tag{eq.1}$$ -
注意:行间公式
$$之后不能换行在$$之后添加换行后,即使在fronter中添加了$\KaTeX$也不能正确渲染。 -
其他使用说明
代码块
-
使用方法参考官方示例
-
简单测试如下
1 2 3 4 5import numpy as np import matplotlib.pyplot as plt if __name__=='__main__': print('hello world') pass -
不显示行号可用
, linenos=false -
不能指定代码行突出显示(语法不同)
绘图
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
嵌入工具
### d3- todo
静态页面
其他效果测试
-
markdown的
==xxx==文本底色高亮无效,可以使用HTML的mark修饰、或者是否可以参考这里自定义模板文件 -
使用
tabs行前不能有空格缩进(?) -
html代码可以使用shortcodes,Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML to Markdown content. Hugo为了不破坏markdown的简洁性用shortcodes解决这些限制。(可带参数的代码片段)例如插入图片可以自行在md文件添加html代码,但可以用hugo自带的figure shortcodes;一个使用shortcodes简化font awesome的示例参考Font Awesome in Hugo(代码中可能跟因为版本有问题)
-
文字框和Tab,可以使用
使用
boxmd如(支持markdown,推荐)1<div class="box">Some markdown contents</div>使用box以上代码输出有bug。
-
font awesome: ,
-
参考csdn: Github Actions自动部署Hugo到Gitee同时刷新Gitee Pages可用github的action定时或者push时触发自动部署(未进行尝试)
-
zzo theme的搜索功能部署到gitpage后不可用,参考这里(未解决)
搜索功能有问题,可能与上条错误原因不同;在调试窗口可以看到,如下错误信息1(index):714 Mixed Content: The page at 'https://xltong.gitee.io/chs/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://xltong.gitee.io//chs/index.json'. This request has been blocked; the content must be served over HTTPS.是因为使用了XMLHttpRequest请求http资源。可能参考的链接有(
未解决):- Mozilla: Mixed Content
- stackoverflow: “Mixed content blocked” when running an HTTP AJAX operation in an HTTPS page
- Resolve Mixed Content insecure XMLHttpRequest endpoint for HTTPS Content in Axios
- csdn:火狐浏览器显示“已阻止载入混合活动内容”的解决方法,参考该文,将相应地方json文件引用路径修改为相对路径(可以直接修改zzo模板的
scripts.html中相应段代码,如图所示)
图4: 修改json文件引用路径
修改样式
- 例如默认的
<kbd>标签效果不明显,可在主题目录中assets/sass/pages/_single.scss的后面加上自定义样式
bug(?)
- katex公式inline环境中,
\mathbf{x}_y这里下划线符号解析错误 - katex公式block环境中
\\换行无效(解析成\),可使用\cr替代(但和LaTex产生差异)(可能有用的参考链接) - katex行间公式不能换行
- 其他