How to implement Travis CI to a Hugo site

What is Travis? Travis is a continuous integration testing tool that integrates with GitHub. It allows you to run automated tests on your code each time a commit is made to the repository. How? Sign in Travis in https://travis-ci.org/ using github account. Enable Source github repo in Travis setting, eg.kencho51/gigathing Create Personal access token in github, the scopes include: repo admin:public_key admin:repo_hook user Copy the token generated and update the Travis Environment Variables as below: GH_TOKEN: paste the github GITHUB_EMAIL: [email protected] GITHUB_USERNAME: kencho51 Create .travis.yml at the directoyy top level language: go dist: xenial env: - HUGO_VERSION="0.74.2" before_install: - sudo apt-get update -qq install: true before_script: - wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb - sudo dpkg -i hugo_${HUGO_VERSION}_Linux-64bit.deb - rm -rf public || exit 0 script: - hugo --gc -v --minify deploy: provider: pages skip_cleanup: true keep_history: true github_token: $GH_TOKEN local_dir: public target_branch: master email: [email protected] name: kencho51 repo: kencho51/kencho51.github.io verbose: true on: branch: master Insert build status into default template, every post will have build status on it. Markdown format: [![Build Status](https://travis-ci.org/kencho51/gigathing.svg?branch=master)](https://travis-ci.org/kencho51/gigathing) Image URL: https://travis-ci.org/kencho51/gigathing.svg?branch=master Reference Using Hugo and Travis CI To Deploy Blog To Github Pages Automatically Two ways to deploy a public GitHub Pages site from a private Hugo repository DEPLOY HUGO TO GITHUB PAGES AND BUILD WITH TRAVIS CI 使用 Travis CI 部署 Hugo 博客到 Github Pages Deploy Hugo from Gitlab CI to Github Pages How I use Travis CI to automatically deploy this blog to GitHub Pages How to deploy Hugo site minimally ...

July 23, 2020 · 2 min · 244 words · Ken Cho

(Hu)go Template Primer

Hugo uses the excellent go html/template library for its template engine. It is an extremely lightweight engine that provides a very small amount of logic. In our experience that it is just the right amount of logic to be able to create a good static website. If you have used other template systems from different languages or frameworks you will find a lot of similarities in go templates. This document is a brief primer on using go templates. The go docs provide more details. ...

April 2, 2014 · 7 min · 1488 words · Michael Henderson

Getting Started with Hugo

Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture. Save it somewhere specific as we will be using it in the next step. More complete instructions are available at installing hugo Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now. Follow the following steps: Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands: ...

April 2, 2014 · 2 min · 349 words · kencho51