Edit on GitHub

Website

Many sections of this website are not fully written or and help filling/fixing them up would be appreciated.

The website is generated using the Hugo static site generator.

Where data is located

The source files of the website are located on GitHub. All changes of master branch of this repository are automatically pushed to live server every 10 minutes. There is also a version with drafts enabled at https://draft.lczero.org/.

Editing (non-GitHub wiki) pages

If you just want do edit a single page without need to create a new one or preview the page looks, you can press [Edit on GitHub] button on the topright corner of every article and edit in GitHub editor.

Editing GitHub wiki pages

Some pages originated from GitHub wiki. Those pages should not be edited in WebSite repository (they would be overwritten anyway). Instead, [Edit on Wiki] button leads to the wiki, where those documents can be edited. Such pages are automatically synchronized with website every ten minutes.

New pages appear in this section of the website. It’s possible to move the document around (and keeping wikiname header), and it will keep being linked/synched to the GitHub wiki page.

The syntax for pages is CommonMark standard of MarkDown.

Setting up HuGo to run locally

If you create pages or plan to contribute non-trivial amount of changes, it’s recommended to setup HuGo locally. It works will both under Windows and Linux. Here is how to do it.

For the site, you need “extended” version of Hugo v0.70.0 or later.

Installing HuGo in Windows

This document from HuGo documentation describes how to install it. Here is what worked for me:

  1. Install Chocolatey (described here):
    1. Press Win key so that Windows Start menu opens.
    2. Type Powershell but do not press Enter. “Windows Powershell” will be found.
    3. Press Run as Administrator button.
    4. Type the following the blue window that opens:
    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    
    1. Chocolatey is installed! You can type choco in command line to check that it’s available. Reboot may be required.
  2. Install HuGo.
    1. Type: choco install hugo-extended -confirm
    2. Hugo should be installed now! You can type hugo to check it. Reboot may be required.

Getting site sources

  1. Download (e.g. from here) and install git on your computer (only needed once, and you may already have it installed in your system, check by typing git).
  2. Fork the repository on GitHub (only needed once per GitHub user).
  3. Clone you repository and subrepositories:
git clone --recurse-submodules [email protected]:YOURUSERNAME/lczero.org.git

Running HuGo server

To start local HuGo server, use this command line:

cd lczero.org
hugo -D server  # Remove -D to stop seeing draft pages.

After that the website will be available by address http://localhost:1313/, and all changes will be shown live on the web page.

Creating a new page

To create a new page, use hugo new command, for example:

hugo new --kind docs watch/teapot.md

That will create a page which will be located at content/watch/teapot.md and available at http://localhost:1313/watch/teapot.

You may want to edit page’s header:

title: "Teapot"  # Change to human readable page title.
weight: 100      # Is used for page sorting withint server.
draft: true      # Change to publish the page.

Drafts

All pages are created as drafts, and there are many stub pages. The version of the website with all drafts rendered is located at https://draft.lczero.org/.

The “production” version of the website is currently located at https://newsite.lczero.org/, with plans to make it the main lczero.org site.

File locations

Hugo has a non-trivial rules for mapping filenames to URLs. Here is how it works roughly:

File location Resulting URL
content/foo/bar.md example.com/foo/bar/
content/foo/bar/index.md example.com/foo/bar/
content/foo/bar/_index.md example.com/foo/bar/

Note that index.md and _index.md has a special meaning.

The difference between _index.md and index.md is that _index.md creates logical subsection.

  • When a page doesn’t have subpages, use index.md.
  • When in doubt, use _index.md (there’s nothing wrong with using it always).

Contents of section

Section pages (pages that have subpages) have table of contents at the bottom of the page by default. Add show_contents: false to the header to switch that off.

Last Updated: 2020-05-20