Congo設定
目錄
設定方式 #
安裝 #
手動下載後取名congo放到themes資料夾內,複製其中的config資料夾到根目錄,在config/_default/hugo.toml中加入theme = "congo"。
設定首頁 #
建立content/_index.md。
自訂CSS #
建立assets/css/custom.css。
自訂配色方案 #
建立assets/css/schemes/myschemes.css。
在config/_default/params.toml裡修改colorScheme = "myscheme"。
自訂404頁面 #
建立layouts/404.html,可以複製themes/congo/layouts/404.html的內容來改。
設定Favicon #
下載favicon.io產生的檔案,將檔案放到static裡。
設定Header Logo #
網站標題旁的logo,檔案放在assets,在params.toml的[header]裡設定logo = "logo.png"。
檔案管理 #
文件可以放在static/files,圖片可以放在static/images,也可以使用Hugo的Page Bundle,把文章和圖片放在同一個資料夾。
content/
└── posts/
└── hugo-tutorial/
├── index.md
├── cover.jpg
├── screenshot-01.png
└── screenshot-02.png
目前設定 #
字體 #
- 一般中英文字體:Noto Sans TC
- 程式碼等寬字體:Noto Sans Mono
顏色 #
預設暗色模式,導覽列按鈕切換。
暗色模式下文字顏色:#f2f2f2 Snow
配色方案:
- Neutral:Congo預設的Gray
- Primary:primary-500顏色:
#0ea5e9Nebula Blue - Secondary:Ocean預設的Cyan
預設主題有的直接從themes/congo/assets/css/schemes裡複製貼上。
自訂CSS #
/* 載入字體 */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&family=Noto+Sans+Mono:wght@400;500;600;700&display=swap");
/* 全站一般文字字體Noto Sans TC */
html,
body {
font-family: "Noto Sans TC", sans-serif;
}
/* 程式碼區塊字體Noto Sans Mono */
pre,
code,
kbd,
samp {
font-family: "Noto Sans Mono", "Noto Sans Mono CJK TC", monospace;
}
/* 調整Header Logo大小 */
header img {
width: 40px;
}
/* 全站字體放大,中文字與西文、數字自動留白 */
html {
font-size: 14pt;
text-autospace: normal;
}
/* 暗色模式文章內文文字改為#f2f2f2 */
.dark .prose {
color: #f2f2f2 !important;
}
/* 淺色模式背景改為#F1F2F3 */
html:not(.dark) body {
background-color: #f1f2f3;
}
/* 調整頁尾copyright文字大小 */
footer p.text-sm {
font-size: 1rem !important;
margin-bottom: 4px !important;
}
/* 調整文章引言lead字體顏色與粗細 */
.lead {
color: #353940 !important;
font-weight: 500 !important;
}
.dark .lead {
color: #a6abb5 !important;
}
/* 文章標籤字體放大、內距加大、邊框加粗 */
article div.flex.flex-wrap.text-xs a {
font-size: 0.875rem !important;
font-weight: 700 !important;
line-height: 1.8 !important;
padding: 3px 8px !important;
border-width: 2px !important;
}
/* 所有底線加粗及調整距離 */
u {
text-decoration-thickness: 2px !important;
text-underline-offset: 5px !important;
}
/* 文章內所有連結字體加粗 */
.prose a {
font-weight: 700 !important;
}
/* 所有連結底線加粗及調整距離 */
a {
text-decoration-thickness: 2px !important;
text-underline-offset: 5px !important;
}
/* 導覽列文字底線加粗及調整距離 */
nav ul li a span {
text-decoration-thickness: 2px !important;
text-underline-offset: 5px !important;
}
/* 調整桌面板左右間距及文章右側目錄寬度 */
@media (min-width: 1024px) {
/* 整體左右間距,預設為128px */
body {
padding-left: 96px !important;
padding-right: 96px !important;
}
/* 右側目錄外層容器 */
.prose > div:has(> .toc) {
width: 260px !important;
min-width: 260px !important;
max-width: 260px !important;
flex: 0 0 260px !important;
box-sizing: border-box;
}
/* 目錄本身 */
.prose .toc {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
/* 目錄文字 */
.prose #TableOfContents {
width: 100%;
max-width: 100%;
overflow-wrap: break-word;
}
}