1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# 版本应为版本号+extended
hugo version
<<'CONTENT'
hugo v0.157.0+extended android/arm64 BuildDate=unknown
CONTENT
# 在站点根目录中操作
rm -rf * .*
# hugo new site quickstart
hugo new site ./
git init
git submodule add https://github.com/CaiJimmy/hugo-theme-stack/ themes/hugo-theme-stack
cd themes/hugo-theme-stack
git log --grep "exampleSite"
# 切换到关键词exampleSite的分支中
git checkout 0fb25c808b484740d4568f487ca916bb7a6beb03
cd -
mv hugo.toml hugo.toml_bak
cp themes/hugo-theme-stack/exampleSite/hugo.yaml ./
# 添加搜索栏
mkdir content/page
cp -rf themes/hugo-theme-stack/exampleSite/content/page/search/ content/page/
# 添加Archive栏
cp -rf themes/hugo-theme-stack/exampleSite/content/page/archives/ content/page/
# 添加Links栏
cp -rf themes/hugo-theme-stack/exampleSite/content/page/links/ content/page/
# 添加About栏
cp -rf themes/hugo-theme-stack/exampleSite/content/page/about/ content/page/
# 添加彩虹背景
cat - >> themes/hugo-theme-stack/layouts/partials/footer/custom.html <<'EOF'
<!-- layouts/partials/footer/custom.html -->
<script
src="https://cdn.jsdelivr.net/gh/zhixuan2333/gh-blog@v0.1.0/js/ribbon.min.js"
integrity="sha384-UEK8ZiP3VgFNP8KnKMKDmd4pAUAOJ59Y2Jo3ED2Z5qKQf6HLHovMxq7Beb9CLPUe"
crossorigin="anonymous"
size="300"
alpha="0.6"
zindex="-1"
defer
></script>
EOF
cat - >> themes/hugo-theme-stack/layouts/partials/footer/custom.html <<'EOF'
<!-- layouts/partials/footer/custom.html -->
<script
src="https://cdn.jsdelivr.net/gh/zhixuan2333/gh-blog@v0.1.0/js/nprogress.min.js"
integrity="sha384-bHDlAEUFxsRI7JfULv3DTpL2IXbbgn4JHQJibgo5iiXSK6Iu8muwqHANhun74Cqg"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/zhixuan2333/gh-blog@v0.1.0/css/nprogress.css"
integrity="sha384-KJyhr2syt5+4M9Pz5dipCvTrtvOmLk/olWVdfhAp858UCa64Ia5GFpTN7+G4BWpE"
crossorigin="anonymous"
/>
<script>
NProgress.start();
document.addEventListener("readystatechange", () => {
if (document.readyState === "interactive") NProgress.inc(0.8);
if (document.readyState === "complete") NProgress.done();
});
</script>
EOF
# 添加网易云短代码
mkdir -p layouts/shortcodes/
cat - > layouts/shortcodes/netease.html <<'EOF'
<iframe
frameborder="no"
border="0"
marginwidth="0"
marginheight="0"
width=330 height=86
src="//music.163.com/outchain/player?type=2&id={{.Get 0}}&auto=0&height=66">
</iframe>
EOF
# 添加文字属性
cat - > layouts/shortcodes/align.html <<'EOF'
<p style="text-align:{{ index .Params 0 }}">{{ index .Params 1 | markdownify }}</p>
EOF
# 插入github仓库
cat - > layouts/shortcodes/github.html <<'EOF'
<div class="github">
<div class="logo">
{{ replace $.Site.Data.SVG.repository "icon" "icon github-icon" | safeHTML }}
<a class="name" href={{ .Get "link" }} target="_blank">{{ .Get "name" }}</a>
</div>
<div class="description">{{ .Get "description" }}</div>
<div class="language">
<span class="language-color" style="background-color: {{ .Get "color" }}"></span>
<span class="language-name">{{ .Get "language" }}</span>
</div>
</div>
EOF
cd public/
git init
git remote add origin remote_repository_url
git add .; git commit -m "upload.sh"; git push -u origin $(git branch | awk '{print $2}'); cd $var1;
# 局域网访问博客效果
hugo server -D --bind 192.168.x.x -p 1313
|