Skip to content

Local Hugo Review App

When working from a local repository, this project allows you to run the command hugo server to stand up a little local server that shows you what the website will look like once it's published.

There are Merge Request features that can make references to this local environment. The two things that are needed are a /.gitlab/route-map.yml file and a /.gitlab-ci.yaml pipeline job.

GitLab CI Job Definition

local:review:
  stage: review
  script:
    - echo "start review app locally for Merge Request links to work.  Run 'hugo server'"
  only:
    - branches
  except:
    - master
  environment:
    name: local
    url: http://127.0.0.1:1313
  variables:
    GIT_STRATEGY: none

Route Map yaml file contents

# pages, but drop the extension (this means no URLs can have a period in them)
- source: /content\/handbook\/(.+?)\..*/
  public: 'handbook/\1/'

If you create more top-level directories under content, be sure to add them and follow the patterns specified in the docs.