$ tldr hugo
hugo
Template-based static site generator. Uses modules, components, and themes.More information: https://gohugo.io.
- Create a new Hugo site:
hugo new site {{path/to/site}}
- Create a new Hugo theme (themes may also be downloaded from https://themes.gohugo.io/):
hugo new theme {{theme_name}}
- Create a new page:
hugo new {{section_name}}/{{filename}}
- Build a site to the ./public/ directory:
hugo
- Build a site including pages that are marked as a "draft":
hugo --buildDrafts
- Build a site to a given directory:
hugo --destination {{path/to/destination}}
- Build a site, start up a webserver to serve it, and automatically reload when pages are edited:
hugo server
$ hugo new site loomt
Congratulations! Your new Hugo site is created in /home/loomt/temp/loomt.
Just a few more steps and you are ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/ or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
$ cd loomt
$ tree
.
├── archetypes
│ └── default.md
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes
# .github/workflows/build.ymlname:Hugo automated deploymenton:push:branches:- main # Set a branch name to trigger deploymentjobs:deploy:runs-on:ubuntu-latestpermissions:contents:writeconcurrency:group:${{ github.workflow }}-${{ github.ref }}steps:- uses:actions/checkout@v3with:submodules:true# Fetch Hugo themes (true OR recursive)fetch-depth:0# Fetch all history for .GitInfo and .Lastmod- name:Setup Hugouses:peaceiris/actions-hugo@v2with:hugo-version:'0.92.2'extended:true- name:Buildrun:hugo --gc --minify# - name: Deploy# uses: peaceiris/actions-gh-pages@v3# # If you're changing the branch from main,# # also change the `main` in `refs/heads/main`# # below accordingly.# if: ${{ github.ref == 'refs/heads/main' }}# with:# github_token: ${{ secrets.GITHUB_TOKEN }}# publish_dir: ./public- name:Deploy # 此处需要按照自己实际修改uses:peaceiris/actions-gh-pages@v3with:deploy_key:${{ secrets.ACTIONS_DEPLOY_KEY }}external_repository:loomts/loomts.github.iopublish_branch: main # default:gh-pagespublish_dir:./public
Custom domains are stored in a CNAME file in the root of your publishing source. You can add or update this file through your repository settings or manually. For more information, see " Managing a custom domain for your GitHub Pages site ." ——Github Docs
[menu]## 菜单栏[[menu.main]]pageref="/posts/"name="Posts"weight=2pre="internal"post="archive"[[menu.main]]pageref="/tags/"name="Tags"weight=4pre="internal"post="tags"[[menu.main]]pageref="/about/"name="About"weight=5pre="internal"post="user-circle"[[menu.main]]# add wiki pagepageref="/wiki/"name="Wiki"weight=6pre="internal"post="wiki"[[menu.main]]weight=7identifier="theme-switcher"[[menu.main]]weight=8identifier="lang-switcher"[[menu.main]]weight=9identifier="search"post="search"
Hugo + Algolia search
Algolia 可以提供 AI 搜索服务,但需要在更新站点时用 POST 请求上传 algolia.json(站点信息) 给 Algolia,以帮助 Algolia 实现搜索服务。按照要求新建站点以及配置 api 即可,上传 algolia.json 可以使用hugo-algolia。因为 MeME 主题有一定的 algolia search 支持,下面仅给出上传 algolia.json 方面的配置。
$ hugo-algolia -s -t --config config.toml
JSON index file was created in public/algolia.json
/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/AlgoliaSearchCore.js:50
throw new errors.AlgoliaSearchError('Please provide an application ID. ' + usage);
^
AlgoliaSearchError: Please provide an application ID. Usage: algoliasearch(applicationID, apiKey, opts)
at AlgoliaSearchNodeJS.AlgoliaSearchCore (/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/AlgoliaSearchCore.js:50:11)
at AlgoliaSearchNodeJS.AlgoliaSearch (/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/AlgoliaSearch.js:11:21)
at AlgoliaSearchNodeJS.AlgoliaSearchServer (/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/server/builds/AlgoliaSearchServer.js:17:17)
at new AlgoliaSearchNodeJS (/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/server/builds/node.js:83:23)
at algoliasearch (/usr/local/lib/node_modules/hugo-algolia/node_modules/algoliasearch/src/server/builds/node.js:68:10)
at HugoAlgolia.HugoAlgolia.sendIndex (/usr/local/lib/node_modules/hugo-algolia/lib/index.js:184:20)
at HugoAlgolia.HugoAlgolia.index (/usr/local/lib/node_modules/hugo-algolia/lib/index.js:122:12)
at Object.<anonymous> (/usr/local/lib/node_modules/hugo-algolia/bin/index.js:23:26)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)