最後上傳時間
一直不能成功…我之後再試試看吧
archieve 不需要index.md即可使用
code block 會被縮進、代碼高亮
def choose(choice):
try:
function = actions[choice]
try:
function()
except Exception as e:
print(str(e))
except KeyError as e:
print(strings.PROMPT_INVALID_ACTION)
loop(food = 0; foodNeeded = 10) {
if (food = foodNeeded) {
exit loop;
// We have enough food; let's go home
} else {
food += 2; // Spend an hour collecting 2 more food
// loop will then run again
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace PDFQFZ
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args));
}
}
}
前言
為何要用HUGO:
因為我先學這個,用HEXO之類的也都可以
用wordpress不好嗎:
服務器搞起來更麻煩,免費的GITHUB更方便
⚠️ Warning
本教程給電腦小白、windows用戶,若有錯處那是因為本人也是個小白,程式一點都不懂
萬事開頭都要先下載
HUGO官網 有給如何下載的詳細步驟
首先我們先下載 chocolatey
用系統管理員權限打開PowerShell
PS:在命令介面直接點右鍵就能貼上命令行
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
用系統管理員權限打開CMD
# 下載HUGO 和 GIT命令行
choco install hugo -y
choco install git -y
基本上你現在打開CMD
打 hugo git 就能有命令行的反應了
如果沒有你要去環境變數把他們加進去
hugo new site mysite
# mysite是我資料夾的名稱
這樣你就能看到一個叫mysite、裡面一堆配置文件的資料夾產生了cd mysite
安裝主題git clone https://github.com/athul/archie.git themes/archie
config.toml 的文件 用記事本或什麼其他的編輯器打開來,你會看到裡面幾行而已baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
你可以直接去主題的readme或是你下載的theme路徑裡 mysite\themes\archie\theme.toml 看看他有沒有推薦的配置選項,直接用他的預設也可以 ex:baseURL = "https://athul.github.io/archie/"
languageCode = "zh-tw"
title = "我的網站"
theme="archie"
copyright = "© Athul"
# Code Highlight
pygmentsstyle = "monokai"
pygmentscodefences = true
pygmentscodefencesguesssyntax = true
disqusShortname = "yourDisqusShortname"
paginate=3 # articles per page
[params]
mode="auto" # color-mode → light,dark,toggle or auto
useCDN=false # don't use CDNs for fonts and icons, instead serve them locally.
subtitle = "Minimal and Clean [blog theme for Hugo](https://github.com/athul/archie)"
mathjax = true # enable MathJax support
katex = true # enable KaTeX support
# Social Tags
[[params.social]]
name = "GitHub"
icon = "github"
url = "https://github.com/athul/archie"
[[params.social]]
name = "Twitter"
icon = "twitter"
url = "https://twitter.com/athulcajay/"
[[params.social]]
name = "GitLab"
icon = "gitlab"
url = "https://gitlab.com/athul/"
# Main menu Items
[[menu.main]]
name = "Home"
url = "/"
weight = 1
[[menu.main]]
name = "All posts"
url = "/posts"
weight = 2
[[menu.main]]
name = "About"
url = "/about"
weight = 3
[[menu.main]]
name = "Tags"
url = "/tags"
weight = 4
\mysite\archetypes\default.md 裡面看到下面的樣式+++
date = "{{ .Date }}"
draft = true
title = "{{ replace .File.ContentBaseName '-' ' ' | title }}"
+++
這是之後在你markdown裡面會自動生成的表頭,格式是toml, 它會記錄你這文件建立的時間、標題、要不要發布、還有它的其他種種狀態 我會建議你換成下面的yaml格式---
date: '{{ .Date }}'
draft: false
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
---
現在你可以去CMD新建一個文章了
first-post可以自訂義名稱
...