Skip to content

guixcn/guixcn.github.io

Repository files navigation

Guix China Community

README

This project is made with org-mode, ox-hugo and Hugo. The org files are in org directory. Org files are converted into Hugo compatible Markdown files using ox-hugo. These Markdown files are then converted into HTML using Hugo.

Build And Publish This Project

Preparation

  • Configure Emacs with org-mode and ox-hugo.
  • Install Hugo.
  • Clone the src branch. This branch contains the source code for the website.
    git clone git@github.com:guixcn/guixcn.github.io.git -b src
        
  • Change into the project directory:
    cd guixcn.github.io
        
  • Update git submodules:
    git submodule update --init
        
  • Clone the master branch into the public directory. This branch contains the compiled result for the website:
    git clone git@github.com:guixcn/guixcn.github.io.git -b master public
        

Build

  • Open this file with Emacs.
  • Execute this code block in Emacs (Hit C-c C-c):
(org-babel-goto-named-src-block "clean-up-hugo-project")
(org-babel-execute-src-block)

(org-babel-goto-named-src-block "convert-org-into-hugo")
(org-babel-execute-src-block)

(org-babel-goto-named-src-block "build-hugo-project")
(org-babel-execute-src-block)

Clean up Hugo project.

rm -rf content/* public/*

Convert Org files into Markdown files.

(save-window-excursion
  (find-file "org/site.org")
  (org-hugo-export-wim-to-md t))
(save-window-excursion
  (find-file "org/blog.org")
  (org-hugo-export-wim-to-md t))
(save-window-excursion
  (find-file "org/wiki.org")
  (org-hugo-export-wim-to-md t))

Build Hugo project.

hugo --debug

Publish

Publish the result to GitHub Pages.

message=$(git show -s --format='%h %s')
cd public
git status
s=$(git status -s)
if [ -n "$s" ]; then
    git add -A
    git status
    git commit -m "${message}"
    git push
fi

Contribute

  • You must accept the License.
  • Clone this project, modify files in the src branch, and send your changes to upstream.

License

Unless otherwise noted, then:

Local Variables