diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000..5bc790c --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,36 @@ +# Sample workflow for building and deploying a Hugo site to GitHub Pages +name: Deploy Hugo site to Pages + +on: + push: + branches: + - main # Set a branch to deploy + +jobs: + deploy: + runs-on: ubuntu-22.04 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: 'latest' + extended: true + + - name: Build + run: hugo --minify + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + commit_message: ${{ github.event.head_commit.message }} + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..574af8f --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Hugo output +public/ +resources/ +.hugo_build.lock + +# Editor +.vscode/ + +# Mac +.DS_Store \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dd62212 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "themes/hextra"] + path = themes/hextra + url = https://github.com/imfing/hextra.git diff --git a/README.md b/README.md new file mode 120000 index 0000000..ef68151 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +./content/docs/_index.md \ No newline at end of file diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..c6f3fce --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +title = '{{ replace .File.ContentBaseName "-" " " | title }}' +date = {{ .Date }} +draft = true ++++ diff --git a/content/_index.zh-cn.md b/content/_index.zh-cn.md new file mode 100644 index 0000000..358671a --- /dev/null +++ b/content/_index.zh-cn.md @@ -0,0 +1,73 @@ +--- +title: SHUSCT Wiki +layout: hextra-home +--- + +{{< hextra/hero-badge >}} +
+ 免费 开源 + {{< icon name="arrow-circle-right" attributes="height=14" >}} +{{< /hextra/hero-badge >}} + +
+{{< hextra/hero-headline >}} + 创建现代化网站 
由 Markdown 和 Hugo 驱动 +{{< /hextra/hero-headline >}} +
+ +
+{{< hextra/hero-subtitle >}} + 极速且全能的 Hugo 主题框架 
为构建现代化的静态网站而生 +{{< /hextra/hero-subtitle >}} +
+ +
+{{< hextra/hero-button text="现在开始" link="docs" >}} +
+ +
+ +{{< hextra/feature-grid >}} + {{< hextra/feature-card + title="快速且功能全面" + subtitle="简单易用,功能强大丰富。" + class="hx-aspect-auto md:hx-aspect-[1.1/1] max-md:hx-min-h-[340px]" + imageClass="hx-top-[40%] hx-left-[24px] hx-w-[180%] sm:hx-w-[110%] dark:hx-opacity-80" + style="background: radial-gradient(ellipse at 50% 80%,rgba(194,97,254,0.15),hsla(0,0%,100%,0));" + >}} + {{< hextra/feature-card + title="Markdown 写作" + subtitle="只需使用 Markdown 进行编辑。多样的 Shortcode 组件开箱即用。" + class="hx-aspect-auto md:hx-aspect-[1.1/1] max-lg:hx-min-h-[340px]" + imageClass="hx-top-[40%] hx-left-[36px] hx-w-[180%] sm:hx-w-[110%] dark:hx-opacity-80" + style="background: radial-gradient(ellipse at 50% 80%,rgba(142,53,74,0.15),hsla(0,0%,100%,0));" + >}} + {{< hextra/feature-card + title="全文搜索" + subtitle="内置 FlexSearch 全文搜索,无需额外设置。" + class="hx-aspect-auto md:hx-aspect-[1.1/1] max-md:hx-min-h-[340px]" + imageClass="hx-top-[40%] hx-left-[36px] hx-w-[110%] sm:hx-w-[110%] dark:hx-opacity-80" + style="background: radial-gradient(ellipse at 50% 80%,rgba(221,210,59,0.15),hsla(0,0%,100%,0));" + >}} + {{< hextra/feature-card + title="轻如羽毛" + subtitle="使用 Hextra 无需依赖 Node.js。由 Hugo 提供支持,Hugo 是最快的静态网站生成器之一,只需一个二进制文件即可在数秒内创建网站。" + >}} + {{< hextra/feature-card + title="响应式布局,暗黑模式" + subtitle="适应不同的屏幕尺寸。内置暗黑模式支持,并根据用户的系统偏好自动切换。" + >}} + {{< hextra/feature-card + title="免费构建和托管" + subtitle="使用 GitHub Actions 进行构建,并在 GitHub Pages 上免费托管。也可以托管在任何静态托管服务上。" + >}} + {{< hextra/feature-card + title="多语言轻松实现" + subtitle="仅需通过在 Markdown 文件后添加语言代码即可创建多语言页面。向您的站点添加 i18n 支持直观易行。" + >}} + {{< hextra/feature-card + title="还有更多..." + icon="sparkles" + subtitle="代码高亮 / 目录 / SEO / RSS / LaTeX 公式 / Mermaid 图标 / 自定义 / 等等..." + >}} +{{< /hextra/feature-grid >}} diff --git a/content/about/index.zh-cn.md b/content/about/index.zh-cn.md new file mode 100644 index 0000000..196fbce --- /dev/null +++ b/content/about/index.zh-cn.md @@ -0,0 +1,20 @@ +--- +title: 关于 +toc: false +--- + +Hextra 是一款简洁、快速、灵活的主题,适用于构建现代化静态站点。Hextra 特别适用于文档网站,但也可用于构建博客、个人网站等各种类型的网站。 + +Hugo 和 Jekyll 类似,是一个静态网站生成器。但与其他生成器不同,Hugo 只有单个可执行文件,这使得它可以轻松地在各种平台上安装和运行。Hugo 的运行速度非常快且可靠性高,能够在几毫秒内渲染数千页的网站。 + +Hextra 被设计为轻量级,具有最小化的内存占用。使用 Hextra 无需安装繁杂的依赖,比如 Node.js;相反,你只需要一个简单的 YAML 配置文件和 Markdown 内容。因此,我们可以专注于内容而非在配置环境上浪费精力。 + +## 鸣谢 + +Hextra 的设计离不开这些项目的支持和其提供的灵感: + +- [Hugo](https://gohugo.io/) +- [Tailwind CSS](https://tailwindcss.com/) +- [Heroicons](https://heroicons.com/) +- [Nextra](https://nextra.vercel.app/) +- [Next.js](https://nextjs.org/) diff --git a/content/blog/Connect-to-GitHub-with-SSH-Keys/add-ssh-key-to-github.png b/content/blog/Connect-to-GitHub-with-SSH-Keys/add-ssh-key-to-github.png new file mode 100644 index 0000000..e8ca295 Binary files /dev/null and b/content/blog/Connect-to-GitHub-with-SSH-Keys/add-ssh-key-to-github.png differ diff --git a/content/blog/Connect-to-GitHub-with-SSH-Keys/index.zh-cn.md b/content/blog/Connect-to-GitHub-with-SSH-Keys/index.zh-cn.md new file mode 100644 index 0000000..332c2ba --- /dev/null +++ b/content/blog/Connect-to-GitHub-with-SSH-Keys/index.zh-cn.md @@ -0,0 +1,102 @@ +--- +title: "利用 SSH 密钥链接 GitHub" +--- + +## 1. 简介 + +SSH 是一种网络协议, 用于计算机之间的加密登录和数据传输. 一对 SSH 密钥由一个私钥和一个公钥组成, 私钥保存在本地, 公钥保存在远程服务器上. + +简单来说: 你将公钥分发给全世界; 他人用你的公钥加密信息, 只有你的私钥才能解密; 你用你的私钥签名信息, 只有你的公钥才能验证. + +> 💬 目前有两种主流的算法生成密钥, 一种是 rsa, 另一种是 ed25519. ed25519 是一种 ECC 算法, 比起传统的 rsa 更加安全和高效. 参考资料: [Ed25519: high-speed high-security signatures](http://ed25519.cr.yp.to/) . + +本文使用 ed25519 算法生成密钥. + +**💡 重点** +- 当你将一对 SSH 密钥绑定到了你的 GitHub 账号后, 你可以在任何电脑上通过私钥访问你的 GitHub 账号. +- 你可以生成额外的密钥, 然后专门利用一对密钥控制一个储存库 (称为 Deploy Key). 该密钥只能访问一个储存库, 而不能访问你的账号. +- SSH 连接 GitHub 通过 443 端口 (而非 22 端口). 由于在国内连接 GitHub 走 22 端口很可能被屏蔽, 因此使用 SSH 连接 GitHub 会更加稳定. + + +## 2. 生成一对 SSH 密钥 + +在任意位置打开终端 (**Windows 用户请打开 Git Bash**), 通过以下命令在当前用户的个人文件夹下创建一个叫 `.ssh` 的文件夹 (如果已经创建, 终端会报错说文件夹已存在; 忽视即可): + +```bash +mkdir ~/.ssh +``` + +通过以下命令创建一对 SSH 密钥: + +```bash +ssh-keygen -t ed25519 -C "your@email.com" -f ~/.ssh/your-key-name +``` + +> 💡 **命令解释** +> - `ssh-keygen` 表示生成 ssh 密钥 +> - `-t ed25519` 表示使用 ed25519 算法; 如果使用 rsa 算法, 建议输入 `-t rsa -b 4096`, 即生成 4096 bits 的密钥 +> - `-C "your@email.com"` 是对该密钥的说明, 引号内的 `your@email.com` 可以替换成任何文字; +> - `-f ~/.ssh/your-key-name` 指出了密钥的生成路径以及密钥的文件名 (可以按需更改), 文件名可以依据自己的需求更改, 但是不要保留后缀名. + +输入命令后终端提示设置密钥的密码, 建议设置一个密码. + +> 📌 **注意**: 在你输入密码时, 终端的界面上不会显示出白色的输入内容字符 (看起来和没输入一样), 这是对周围环境的防范. + +再次输入与刚刚相同的密码, 匹配成功后提示密钥成功生成, 并输出了密钥的指纹和随机图像; 可以忽略这些内容. + +> 💡 **检查密钥是否成功生成**: 通过命令 `ls ~/.ssh` 可以查看路径下的所有文件; 你应该至少看到两个文件, 一个是 `your-key-name`, 另一个是 `your-key-name.pub`, 分别对应私钥和公钥. + + +## 3. 为密钥配置 config 文件 + +进入路径 `~/.ssh` ; 新建一个文件, 取名为 `config` (**不要保留任何后缀名**); 在文件末尾加入以下内容 (`Identity File` 是你的密钥路径): + +``` +Host github.com + Hostname ssh.github.com + Port 443 + User git + PreferredAuthentications publickey + IdentityFile ~/.ssh/your-key-name + TCPKeepAlive yes + IdentitiesOnly yes +``` + +## 4. 将公钥添加到 GitHub + +接着我们要在自己的 GitHub 账号中添加公钥, 这样就可以实现利用私钥访问 GitHub 账号. + +在你的电脑上, 复制 `~/.ssh` 路径下 `your-key-name.pub` 文件中的所有内容. + +根据 Fig.1: +1. 打开 Github, 登录账号, 点击右上角头像; +2. 点击 `Settings` 按钮进入设置页; +3. 在页面左侧栏中找到 `SSH and GPG keys` , 点击进入; +4. 点击右侧按钮 `New SSH key` 添加一个 ssh 公钥; +5. 为公钥随便取个名字; +6. 在 Key 窗口粘贴前面复制的 `your-key-name.pub` 内的内容; +7. 点击按钮 `Add SSH key`. + + +![](./add-ssh-key-to-github.png) + +

+Figure 1. 如何给 GitHub 添加 SSH 公钥 +

+ +回到电脑, 任意位置打开终端, 输入以下命令测试和 github 的 ssh 连接: + +``` +ssh -T git@github.com +``` + + +终端提示输入密码, 输入刚才设置的密码. + +**终端提示该密钥还没被授权 (Authenticate), 询问否授权; 输入 `yes` 后再回车**. + +接着会有类似于: `Hi jamesnulliu! You've successfully authenticated, but GitHub does not provide shell access.` 的提示. + +## 5. 进阶: 为某个储存库添加 Deploy Key + +To do ... \ No newline at end of file diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/create-a-github-repo.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/create-a-github-repo.png new file mode 100644 index 0000000..7cfda4c Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/create-a-github-repo.png differ diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add-commit.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add-commit.png new file mode 100644 index 0000000..d227786 Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add-commit.png differ diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add.png new file mode 100644 index 0000000..0f7ef93 Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-add.png differ diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-commit.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-commit.png new file mode 100644 index 0000000..16d0258 Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-commit.png differ diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-init.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-init.png new file mode 100644 index 0000000..520add2 Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/git-init.png differ diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/index.zh-cn.md b/content/blog/Git-Speedrun-Guide-Part-1-Basics/index.zh-cn.md new file mode 100644 index 0000000..7bc6c1b --- /dev/null +++ b/content/blog/Git-Speedrun-Guide-Part-1-Basics/index.zh-cn.md @@ -0,0 +1,214 @@ +--- +title: "Git 速通指南 | Part 1: 基础" +--- + +## 1. 安装 Git + +请参考文章: [安装 Git](Install-Git_zh.md) . + +> 📌 **注意** +> 如果你是 Windows 用户, 由于这个 [Issue](https://github.com/gitextensions/gitextensions/issues/5073) 尚未被解决, 我们建议使用 Git Bash (而非 PowerShell) 执行 Git 命令. + +## 2. 配置 Git + +在进行版本管理前需要向 Git 提供 user 的信息; 具体来说, 你需要设置 (当前工作区或全局的) : + +- `user.name` +- `user.email` + +> 💬 你的所有 commit 记录中都会包含上述信息. + +为了简化流程, 我们直接设置全局的 user 信息. + +打开终端, 输入以下两条指令分别设置 `user.name` 和 `user.email` (请将 `<...>` 替换为合适内容): + +```bash +git config --global user.name "" +git config --global user.email "" +``` + +设置完成后, 除非重装了 Git 或想主动更改信息, 否则不用再次设置. + +输入以下命令将 Git 的默认分支名从 `master` 改为 `main`: + +```bash +git config --global init.defaultBranch main +``` + +更改后, 当你在一个新的工作区内执行 `git init` 时, Git 会自动将默认分支名设为 `main`. + +## 3. 本地 Git 储存库 +### 3.1. 在工作区内创建本地 Git 储存库 + +> 💬 工作区一般指一个项目的根目录, 或者说项目文件夹. + +你可以为任意一个工作区创建一个本地 Git 储存库, 进而对储存库中的文件进行版本控制. + +打开终端 cd 到工作区路径 (或者在工作区文件夹内的空白处右键, 选择打开终端), 输入以下命令可以将当前工作区创建为一个本地 Git 储存库: + +```bash +git init +``` + +![](./git-init.png) + +

+Figure 1. git init 做了什么 +

+ +在 Fig.1 中, 由于我们刚刚创建了一个 Git 储存库, 但还没告诉储存库: "**你应该去跟踪工作区里的 `main.cpp` 的改动.**"; 因此当前 `main.cpp` 这个文件处于 `Untracked` 的状态." + +通过以下命令可以查看当前工作区的状态: + +```bash +git status +``` + +### 3.2. 将改动 commit 到本地 Git 储存库 + +在 [3.1. 在工作区内创建本地 Git 储存库](#31-在工作区内创建本地-git-储存库) 中, 我们创建了一个本地 Git 储存库, 并且当前储存库中的 `main.cpp` 处于 `Untracked` 状态. + +参考 Fig.2, 可以利用以下命令将工作区内的改动 `add` 到缓存区 (`add` 后, 改动还没被正式记录, 只是被缓存了): + +``` +git add +``` + +![](./git-add.png) + +

+Figure 2. git add 做了什么 +

+ +参考 Fig.3, 接着利用以下命令可以正式将改动 `commit` 到本地 Git 储存库 (将 `` 替换为合适内容, 用于描述这次 `commit` 的内容): + +```bash +git commit -m "" +``` + + +![](./git-commit.png) + +

+Figure 3. git commit 做了什么 +

+ +`commit` 完成后, 当前的**工作区内的所有内容**将成为一个**版本**, 记录在本地 Git 储存库中. + +> 💬 如果只执行 `git commit`, Git 会打开一个文本编辑器 (默认为 Vim) 让你描写详细的 `commit` 内容. + +接着我们修改文件 `main.cpp` 中的内容 (比如写几行代码), 同时在工作区内新建一个文件 `tool.cpp`. + +执行命令 `git status`, 终端会提示 `main.cpp` 处于 `Modified` 的状态, 而 `tool.cpp` 处于 `Untracked` 的状态. + + +参考 Fig.4, 输入以下两条命令将**当前路径下**的**所有的更改**都 `add` 进缓存区并 `commit` 为一个新版本: + +```bash +git add . +git commit -m "" +``` + +![](./git-add-commit.png) + +

+Figure 4. 创建第二个版本 +

+ +Fig.4 中的 Version 2 是当前项目的最新版本. + +> 💬 之后的开发过程中如果出现问题, 可以进行**版本回退**, **版本比较**等操作. + +## 4. 远程储存库 + +很多时候, 我们需要在不同的电脑上部署某个项目进行多人协同开发. 因此出现 "将本地 Git 储存库同步到一个远程储存库 (例如 GitHub)" 的想法. + + +### 4.1. 生成 SSH 密钥并连接 GitHub + +参考文章: [利用 SSH 密钥链接 GitHub](Connect-to-GitHub-with-SSH-Keys_zh.md) . + +### 4.2. 创建一个 GitHub 储存库 + +根据 Fig.5, 我们可以在 GitHub 上创建一个新的远程 Git 储存库: +1. 输入 GitHub 的网址进入首页并登录. +2. 点击左侧的 `New` 按钮创建一个新储存库. +3. 给储存库取个名字. +4. 写一个对于当前储存库的简短介绍. +5. 选择是否公开储存库, 如果不公开, 除了你以外别人都无法看到你的储存库. +6. 选择是否添加一个 README 文件, 相当于对自己储存库的详细介绍文件. README 文件会展示在储存库的首页. +7. 选择是否添加 .gitignore 文件; 目的是强制地不跟踪项目中的某些文件. +8. 选择一个 licence, 也就是告诉别人可以怎么使用你的代码: 能不能进行商业行为, 能不能直接复制你的代码不注明你是作者之类的. +9. GitHub 上目前把默认分支名从 master 改成 main 了, 这是为了回应 Black Lives Matter 运动. +10. 上面 9 步设置完后, 点右下角 `Create repository`, 你就能成功创建一个远程 GitHub 储存库, 并且跳到储存库的首页了😁. + + +![](./create-a-github-repo.png) + +

+Figure 5. 如何创建一个远程 GitHub 储存库 +

+ +> 📌 **注意**: GitHub 上创建的储存库默认分支名为 `main` (而非 `master`). + +根据 Fig.6, 打开刚刚创建的储存库, 获取远程储存库的 SSH 地址. + +![](./repo-ssh-address.png) + +

+Figure 6. 获取远程储存库的 SSH 地址 +

+ +### 4.3. 关联本地储存库与远程储存库 + +在 [3. 本地 Git 储存库](#3-本地-git-储存库) 中, 我们已经创建了一个本地 Git 储存库, 并且提交了一些更改; 同时在 [4.2. 创建一个 GitHub 储存库](#42-创建一个-github-储存库) 中, 我们在 GitHub 上创建了一个新的远程 Git 储存库, 并获取了远程储存库的 SSH 地址. + +接下来我们将关联这个这两个储存库. + +打开终端, 将终端路径切换到本地储存库, 通过以下命令将远程储存库的 SSH 地址添加至 `origin` (将 `` 改为储存库的 SSH 地址): + +```bash +git remote add origin +``` + +> 💡 `origin` 是一个默认的用以保存远程储存库地址的变量; 你可以定义其他变量储存多个远程储存库地址. + +假设远程储存库的默认分支名为 `main`, 先 `pull` 远程储存库中的内容: + +```bash +git pull origin main +``` + +> 💡 `pull` 操作会把远程储存库中的较新内容拉取到本地储存库. + +切换本地分支以确保在 `main` 分支上进行操作: + +```bash +git switch main +``` + +将本地 Git 储存库的 `main` 分支与远程储存库的 `main` 分支关联: + +```bash +git branch --set-upstream-to=origin/main main +``` + +`commit` 本地更改至本地 Git 储存库, 然后 `push` 至远程储存库: + +```bash +git add . +git commit -m "Initial Update" +git push origin main +``` + +> 💡 `push` 操作会把本地储存库中较新的内容推送至远程储存库. + +4.4. `clone` 远程储存库 + +对于一个已有的远程储存库, 你可以直接通过以下命令将其 `clone` 至本地: + +```bash +git clone +``` + +此时在当前路径下会生成一个与远程储存库同名的文件夹, 里面包含了远程储存库的所有内容. 该储存库已经与远程储存库关联, 将终端路径切换至该文件夹后, 你可以直接进行 `pull`, `push` 等操作. diff --git a/content/blog/Git-Speedrun-Guide-Part-1-Basics/repo-ssh-address.png b/content/blog/Git-Speedrun-Guide-Part-1-Basics/repo-ssh-address.png new file mode 100644 index 0000000..5c1920e Binary files /dev/null and b/content/blog/Git-Speedrun-Guide-Part-1-Basics/repo-ssh-address.png differ diff --git a/content/blog/Install-Git/index.zh-cn.md b/content/blog/Install-Git/index.zh-cn.md new file mode 100644 index 0000000..de27ccf --- /dev/null +++ b/content/blog/Install-Git/index.zh-cn.md @@ -0,0 +1,27 @@ +--- +title: "安装 Git" +--- + +## 1. 在 Linux 上安装 Git + +以 Debian/Ubuntu 为例: + +```bash +sudo apt install git +``` + +## 2. 在 Windows 上安装 Git + +安装 Scoop (参考: [在 Windows 上安装 Scoop](Install-Scoop-on-Windows_zh.md)) 后, 在终端中运行以下命令以安装 Git: + +```powershell +scoop install main/git +``` + +安装完成后, 输入以下命令: + +```bash +git bash +``` + +此时会额外弹出一个 PuTTY 窗口 (即 Git Bash); 由于这个 [Issue](https://github.com/gitextensions/gitextensions/issues/5073) 尚未被解决, **我们强烈建议在这个窗口中使用 Git 命令 (而非 PowerShell)**. \ No newline at end of file diff --git a/content/blog/Install-Scoop-on-Windows/index.zh-cn.md b/content/blog/Install-Scoop-on-Windows/index.zh-cn.md new file mode 100644 index 0000000..5ea72f5 --- /dev/null +++ b/content/blog/Install-Scoop-on-Windows/index.zh-cn.md @@ -0,0 +1,45 @@ +--- +title: "在 Windows 上安装 Scoop" +--- + +Scoop 是一个命令行下的 Windows 应用安装工具, 类似于 Linux 下的 apt-get 或者 macOS 下的 Homebrew. Scoop 通过一个简单的命令行界面, 可以帮助你快速安装软件, 而不需要打开浏览器, 下载安装包, 解压安装等繁琐的操作. + +## 1. 安装 PowerShell 7 + +目前 Windows 自带的 PowerShell 版本较低, 我们推荐使用 PowerShell 7 以获得更好的兼容性. + +打开终端, 输入以下命令安装 PowerShell 7: + +```powershell +winget install --id Microsoft.Powershell --source winget +``` + +重启终端, 定位到 `Settings`, 在 `Startup` 部分将 `Default profile` 设置为 `PowerShell 7`, 参考 Fig.1: + +![](./pwsh-settings.png) + +

+Figure 1. Set PowerShell 7 as the default terminal. +

+ +重启终端即可默认打开 PowerShell 7; 输入以下命令改变 PowerShell 7 的执行策略以允许运行脚本: + +```powershell +# Set Execution Policy for CurrentUser +Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + +# Set Execution Policy for Process +[System.Environment]::SetEnvironmentVariable('PSExecutionPolicyPreference', 'RemoteSigned', [System.EnvironmentVariableTarget]::User) +``` + +更改后, 重启终端以使设置生效. + +## 2. 安装 Scoop 包管理器 + +在终端中运行以下命令以安装 Scoop: + +```powershell +irm get.scoop.sh -outfile 'install.ps1' # Download the install script +.\install.ps1 # Run the script +Remove-Item install.ps1 # Clean up the script +``` diff --git a/content/blog/Install-Scoop-on-Windows/pwsh-settings.png b/content/blog/Install-Scoop-on-Windows/pwsh-settings.png new file mode 100644 index 0000000..2c37a43 Binary files /dev/null and b/content/blog/Install-Scoop-on-Windows/pwsh-settings.png differ diff --git a/content/blog/_index.zh-cn.md b/content/blog/_index.zh-cn.md new file mode 100644 index 0000000..3389c28 --- /dev/null +++ b/content/blog/_index.zh-cn.md @@ -0,0 +1,10 @@ +--- +title: "博客" +--- + +
+{{< hextra/hero-badge link="index.xml" >}} + RSS 订阅 + {{< icon name="rss" attributes="height=14" >}} +{{< /hextra/hero-badge >}} +
diff --git a/content/docs/_index.zh-cn.md b/content/docs/_index.zh-cn.md new file mode 100644 index 0000000..bd3a7ac --- /dev/null +++ b/content/docs/_index.zh-cn.md @@ -0,0 +1,40 @@ +--- +linkTitle: "文档" +title: 前言 +--- + +👋 你好!欢迎来到 Hextra 文档! + + + +## Hextra 是什么? + +Hextra 是一款现代、快速且内置丰富功能的 [Hugo][hugo] 主题,它是用 [Tailwind CSS][tailwind-css] 构建的。该主题旨在创建美观的文档、博客和网站,提供了开箱即用的功能和灵活性以满足各种需求。 + +## 功能特点 + +- **优美的设计** - 受到 Nextra 的启发,Hextra 利用 Tailwind CSS 提供了一种现代设计,使您的网站看起来出色。 +- **响应式布局和深色模式** - 无论是在移动设备、平板还是桌面上,都表现出色。同时支持深色模式以适应各种光线条件。 +- **快速和轻量级** - 由 Hugo 驱动,一个轻量级且超快的静态网站生成器,封装在一个单一的二进制文件中,Hextra 保持其占用极小。使用它不需要 Javascript 或 Node.js。 +- **全文搜索** - 内置的离线全文搜索由 FlexSearch 提供支持,无需额外配置。 +- **功能全面** - 支持 Markdown、语法高亮、LaTeX 数学公式、图表以及 Shortcodes 元素以增强您的内容。目录、面包屑、分页、侧边栏导航等都会自动生成。 +- **多语言和 SEO 支持** - Hugo 的多语言模式轻松支持多语言网站。对于 SEO 标签、Open Graph 和 Twitter 卡片,也提供了开箱即用的支持。 + +## 有问题或反馈? + +{{< callout emoji="❓" >}} + Hextra 仍在积极开发中。 + 有问题或反馈?请随时[提出问题](https://github.com/imfing/hextra/issues)! +{{< /callout >}} + +## 接下来 + +直接进入以下部分开始: + +{{< cards >}} + {{< card link="getting-started" title="入门指南" icon="document-text" subtitle="学习如何使用 Hextra 创建网站" >}} +{{< /cards >}} + +[hugo]: https://gohugo.io/ +[flex-search]: https://github.com/nextapps-de/flexsearch +[tailwind-css]: https://tailwindcss.com/ diff --git a/content/docs/getting-started.zh-cn.md b/content/docs/getting-started.zh-cn.md new file mode 100644 index 0000000..1e4c813 --- /dev/null +++ b/content/docs/getting-started.zh-cn.md @@ -0,0 +1,142 @@ +--- +title: 快速开始 +weight: 1 +next: /docs/guide +prev: /docs +--- + +## 使用模板快速开始 + +{{< icon "github" >}} [imfing/hextra-starter-template](https://github.com/imfing/hextra-starter-template) + +通过使用上面的模板仓库,您将能够快速地开始。 + + + +我们提供了一个 [GitHub Actions 工作流](https://docs.github.com/cn/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow),它可以帮助您自动构建并部署您的网站到 GitHub Pages,并免费托管。 + +[🌐 演示 ↗](https://imfing.github.io/hextra-starter-template/) + +## 作为新项目开始 + +### 前提条件 + +在开始之前,请确保我们已经安装了 [Hugo](https://gohugo.io/)。 +请参考 Hugo 的[官方安装指南](https://gohugo.io/installation/)以获取更多详情。 + +[Hugo 模块](https://gohugo.io/hugo-modules/)是管理 Hugo 主题的推荐方式。要使用 Hugo 模块,我们需要安装 [Git](https://git-scm.com/) 和 [Go](https://go.dev/)。 + +### 初始化 Hugo 站点 + +```shell +hugo new site my-site --format=yaml +``` + +### 通过 Hugo Module 安装 + +```shell +# 初始化 Hugo 模块 +cd my-site +hugo mod init github.com/username/my-site + +# 添加 Hextra +hugo mod get github.com/imfing/hextra +``` + +编辑 `hugo.yaml` 以启用 Hextra: + +```yaml +module: + imports: + - path: github.com/imfing/hextra +``` + +### 通过 Git Submodule 安装 + +#### 先决条件 + +在我们开始之前,你必须先确保以下软件已经安装: + +- [Hugo (extended version)](https://gohugo.io/installation/) +- [Git](https://git-scm.com/) + +#### 步骤 + +{{% steps %}} + +### 初始化 Hugo 站点 + +```shell +hugo new site my-site --format=yaml +``` + +### 将 Hextra 添加为 Git Submodule + +```shell +git submodule add https://github.com/imfing/hextra.git themes/hextra +``` + +添加以下内容来配置 `hugo.yaml` 以使用 Hextra: + +```yaml +theme: hextra +``` + +### 创建你的第一个内容页 + +让我们为主页和文档页面创建一个新的内容页面: + +```shell +hugo new content/_index.md +hugo new content/docs/_index.md +``` + +### 在本地预览站点 + +```shell +hugo server --buildDrafts --disableFastRender +``` + +瞧!你现在可以在 `http://localhost:1313/` 看到你的新站点。 + +{{% /steps %}} + + + + +使用 [CI/CD](https://en.wikipedia.org/wiki/CI/CD) 进行部署时,必须确保在运行 `hugo` 命令之前执行以下命令。 + +```shell +git submodule update --init +``` + +如果不运行此命令,theme 中将不会存在 Hextra 文件,进而导致构建失败。 + + +{{% details title="如何更新主题?" %}} + +如需把项目中所有的 Hugo Modules 都升级到最新,在终端中运行此命令: + +```shell +hugo mod get -u +``` + +如需把 Hextra 升级到[最新的发行版本](https://github.com/imfing/hextra/releases), 在终端中运行此命令: + +```shell +hugo mod get -u github.com/imfing/hextra +``` + +如果你需要获得更多信息,参见 [Hugo Modules](https://gohugo.io/hugo-modules/use-modules/#update-all-modules). + +{{% /details %}} + +## 接下来 + +探索这些文档以便添加更多内容: + +{{< cards >}} + {{< card link="../guide/organize-files" title="Organize Files" icon="document-duplicate" >}} + {{< card link="../guide/configuration" title="Configuration" icon="adjustments" >}} + {{< card link="../guide/markdown" title="Markdown" icon="markdown" >}} +{{< /cards >}} diff --git a/hugo.yaml b/hugo.yaml new file mode 100644 index 0000000..f39314b --- /dev/null +++ b/hugo.yaml @@ -0,0 +1,156 @@ +# Configuration +baseURL: "https://shusct.github.io/wiki" +title: "Hextra" +theme: "hextra" + +enableRobotsTXT: false +# enableGitInfo: true +# enableEmoji: false +hasCJKLanguage: true + +# services: +# googleAnalytics: +# ID: G-MEASUREMENT_ID + +outputs: + home: [HTML] + page: [HTML] + section: [HTML, RSS] + +defaultContentLanguage: zh-CN +languages: + en: + languageName: English + weight: 2 + title: SHUSCT Wiki + zh-cn: + languageName: 简体中文 + languageCode: zh-CN + weight: 1 + title: SHUSCT Wiki + +# module: +# hugoVersion: +# extended: true +# min: "0.112.0" + +# workspace: hugo.work +# imports: +# - path: github.com/imfing/hextra + +markup: + goldmark: + renderer: + unsafe: true + highlight: + noClasses: false + +enableInlineShortcodes: true + +menu: + main: + - identifier: documentation + name: Documentation + pageRef: /docs + weight: 1 + - identifier: blog + name: Blog + pageRef: /blog + weight: 2 + - identifier: about + name: About + pageRef: /about + weight: 3 + - name: Search + weight: 4 + params: + type: search + - name: GitHub + weight: 5 + url: "https://github.com/SHUSCT/Wiki" + params: + icon: github + + sidebar: + - identifier: more + name: More + params: + type: separator + weight: 1 + - identifier: about + name: "About" + pageRef: "/about" + weight: 2 + +params: + description: Modern, responsive, batteries-included Hugo theme for creating beautiful static websites. + + navbar: + displayTitle: true + displayLogo: true + logo: + path: images/logo.svg + dark: images/logo-dark.svg + # width: 40 + # height: 20 + # link: / + width: wide + + page: + # full (100%), wide (90rem), normal (1280px) + width: normal + + theme: + # light | dark | system + default: system + displayToggle: true + + footer: + enable: true + displayCopyright: true + displayPoweredBy: true + width: normal + + displayUpdatedDate: true + dateFormat: "January 2, 2006" + + # Search + # flexsearch is enabled by default + search: + enable: true + type: flexsearch + + flexsearch: + # index page by: content | summary | heading | title + index: content + # full | forward | reverse | strict + # https://github.com/nextapps-de/flexsearch/#tokenizer-prefix-search + tokenize: forward + + editURL: + enable: true + base: "https://github.com/SHUSCT/Wiki/edit/main/exampleSite/content" + + blog: + list: + displayTags: true + # date | lastmod | publishDate | title | weight + sortBy: date + sortOrder: desc # or "asc" + + comments: + enable: false + type: giscus + + # https://giscus.app/ + giscus: + repo: imfing/hextra + repoId: R_kgDOJ9fJag + category: General + categoryId: DIC_kwDOJ9fJas4CY7gW + # mapping: pathname + # strict: 0 + # reactionsEnabled: 1 + # emitMetadata: 0 + # inputPosition: top + # lang: en \ No newline at end of file diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml new file mode 100644 index 0000000..15f780b --- /dev/null +++ b/i18n/zh-cn.yaml @@ -0,0 +1,4 @@ +documentation: "文档" +blog: "博客" +about: "关于" +more: "更多" \ No newline at end of file diff --git a/themes/hextra b/themes/hextra new file mode 160000 index 0000000..1313415 --- /dev/null +++ b/themes/hextra @@ -0,0 +1 @@ +Subproject commit 1313415c8b4e2c559b7b133506d6599d1723b807