1 Star 0 Fork 0

LMingJian / my-hugo-theme-doks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Doks 客制化修改

原项目:https://github.com/h-enk/doks

什么是 Doks?

Doks 是 Hugo 的一个主题,能帮助用户构建安全、快速和 SEO 就绪的文档网站,支持轻松更新和自定义。

这项目是什么?

本项目是针对 Doks 的客制化修改,目的是让 Doks 更容易使用,界面更便于展示内容。

项目环境要求什么?

  • Node.js 版本大于 16.16.0,需要使用 npm 进行资源的管理和命令的执行。
  • Hugo 版本大于 0.107.0,并且可执行文件路径在系统路径中。

如何使用 Doks?

1.资源安装

克隆项目到本地,进入项目文件夹,执行npm install。在执行命令后,可能需要执行npm audit fix进行修补。

2.启动调试

执行命令npm run start

3.修改网站配置

.\config\_default\params.toml中,修改以下内容可以变更网站标题等信息。

## Homepage
title = "Doks"
titleSeparator = "-"
titleAddition = "Modern Documentation Theme"
description = "Doks is a Hugo theme"

在同一文件中,修改以下内容可以变更网站组织信息。

## JSON-LD(A standardized format for user information)
# schemaType = "Person"
schemaType = "Organization"
schemaName = "Doks"
schemaAuthor = "Henk Verlinde"

在同一文件中,修改以下内容可以变更网站版权信息。

# Footer
footer = "Powered by <a class=\"text-muted\" href=\"https://www.netlify.com/\">Netlify</a>, <a class=\"text-muted\" href=\"https://gohugo.io/\">Hugo</a>, and <a class=\"text-muted\" href=\"https://getdoks.org/\">Doks</a></br>Article author xxx"

# Feed
copyRight = "Copyright (c) 2020-2023 Henk Verlinde and Article author xxx"

.\config\_default\config.toml中,修改以下内容可以变更网站链接。

baseurl = "https://doks.netlify.app/"
canonifyURLs = false
disableAliases = true
disableHugoGeneratorInject = true
enableEmoji = true
enableGitInfo = false
enableRobotsTXT = true
paginate = 7
rssLimit = 10

4.修改主页内容

.\layouts\index.html中,可以对网站主页根据需求进行修改。如下面所示内容,其中{{ .Title }}{{ .Params.description }}等内容会自动从 Markdown 文件.\content\en\_index.md的元数据中获取。

{{ define "main" }}
<section class="section container-fluid mt-n3 pb-3">
  <div class="row justify-content-center">
    <div class="col-lg-12 text-center">
      <h1 class="mt-0">{{ .Title }}</h1>
    </div>
    <div class="col-lg-9 col-xl-8 text-center">
      <h1 class="mt-0">{{ .Params.description | safeHTML }}</h1>
      <h1 class="mt-0">{{ .Params.lead | safeHTML }}</h1>
      <!--<p class="lead">{{ .Params.lead | safeHTML }}</p>-->
    </div>
  </div>
</section>
{{ end }}

Markdown 文件元数据中对应内容通过{{ ... }}在网站上获取展示。

---
title : "Hi there"
description: "Welcome to my blog"
lead: "<(^-^)>"
---

5.修改页眉菜单内容

.\config\_default\menus\menus.en.toml中,可以对网站页眉的菜单链接进行修改。修改以下内容设置菜单名称和跳转链接。

[[main]]
  name = "Docs"
  url = "/docs/"
  weight = 10

[[main]]
  name = "Blog"
  url = "/blog/"
  weight = 20

6.文章内容的展示

.\content\en文件夹中默认有着docs, blog, link三个文件夹,分别对应不同的界面,对应的界面模板文件位于.\layouts中。三界面分别展示如下的文档结构内容。

docs: /docs 展示一级目录的名称路径,/docs/help 展示该目录下包含文章名称路径,HTML 布局对应 .\layouts\docs 文件夹
  --help
    -_index.md
    -A.md
    -B.md
  --prologue
    -_index.md
    -A.md
  --_index.md
  
blog: /blog 展示一级目录的名称路径,/blog/welcome 展示文章内容,HTML 布局对应 .\layouts\blog 文件夹
  --say-hello
    -_index.md
  --welcome
    -_index.md
  --_index.md

link: /link 展示一级目录的名称路径,HTML 布局对应 .\layouts\link 文件夹
  --hugo
    -_index.md
  --_index.md

7.Github Action 部署

创建文件.github\workflows\deploy.yml,并填入以下代码。

# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

# Default to bash
defaults:
  run:
    shell: bash

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    env:
      HUGO_VERSION: 0.108.0
    steps:
      - name: Install Hugo CLI
        run: |
          wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
          && sudo dpkg -i ${{ runner.temp }}/hugo.deb
      - name: Install Dart Sass Embedded
        run: sudo snap install dart-sass-embedded
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: recursive
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v3
      - name: Install Node.js dependencies
        run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
      - name: Build production website
        run: npm run build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
        with:
          path: ./public

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2
MIT License Copyright (c) 2018-present, Gridsome Copyright (c) 2020-present, Henk Verlinde Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

对 Hugo 主题 Doks 的客制化修改 展开 收起
HTML 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
HTML
1
https://gitee.com/LMingJian/my-hugo-theme-doks.git
git@gitee.com:LMingJian/my-hugo-theme-doks.git
LMingJian
my-hugo-theme-doks
my-hugo-theme-doks
master

搜索帮助