Skip to main content

    New project

    Before any theme setup, we need to create a Hugo project.

    To achieve that, you may follow the instructions at https://gohugo.io/getting-started/quick-start/ or follow the steps below (if Hugo is already installed, and Go if you intend to import this theme as recommended).

    Project initialization

    To initialize a Hugo project, it’s simple (this will generate a minimal boilerplate):

    hugo new site <site name> --destination .
    

    To import the hugo-primer theme, the following properties must be added to the hugo.(yaml|toml) configuration file (on my end, I prefer the yaml format):

    theme: github.com/kilianpaquier/hugo-primer
    
    module:
      imports:
        - path: github.com/kilianpaquier/hugo-primer
    

    You can then initialize the go.mod file and tidy it with the following commands to download this theme as a dependency (like you would with Go):

    hugo mod init github.com/<username>/<site name>
    hugo mod tidy
    

    Git submodule

    If you intend to go with a Git submodule, two possibilities:

    With SSH:

    git submodule add git@github.com:kilianpaquier/hugo-primer.git themes/hugo-primer
    

    With HTTPS:

    git submodule add https://github.com/kilianpaquier/hugo-primer.git themes/hugo-primer
    

    You then need to update the hugo.(yaml|toml) configuration with the following property:

    theme: hugo-primer
    

    Default configuration

    For the intended experience with the hugo-primer theme, its default configuration should be merged with your own:

    _merge: deep
    

    Start website

    You are now ready to start your Hugo website:

    hugo server --disableFastRender --destination dist