Skip to content

Instantly share code, notes, and snippets.

@RickCogley
Last active January 29, 2022 02:08
Show Gist options
  • Select an option

  • Save RickCogley/5673669a5c6e9b05070cd4c50e4bd50f to your computer and use it in GitHub Desktop.

Select an option

Save RickCogley/5673669a5c6e9b05070cd4c50e4bd50f to your computer and use it in GitHub Desktop.

Revisions

  1. RickCogley revised this gist Jun 7, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ! Readme.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@ I use a Mac with ``hugo``, and have some ``zsh`` functions in my ``.zshrc`` file

    I have a bunch of functions for running ``hugo server`` with different ports to keep the sites out of each other's hair. Then I have some functions for generating the sites and pushing to production.

    Once you have the functions written up, you can just execute ``hugoserver-1`` to start the local server on port 1377, in the case below, and ctrl-c to stop it. And ``hugodeploy-1`` to generate and push to your web server via ``rsync``.

    The sample below is to make it easy to understand the gist (get it?). The ugly truth is here:

    https://github.com/RickCogley/dotfiles/blob/master/zsh/zshrc
  2. RickCogley created this gist Jun 7, 2017.
    7 changes: 7 additions & 0 deletions ! Readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    I use a Mac with ``hugo``, and have some ``zsh`` functions in my ``.zshrc`` file, to make my life easier.

    I have a bunch of functions for running ``hugo server`` with different ports to keep the sites out of each other's hair. Then I have some functions for generating the sites and pushing to production.

    The sample below is to make it easy to understand the gist (get it?). The ugly truth is here:

    https://github.com/RickCogley/dotfiles/blob/master/zsh/zshrc
    14 changes: 14 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function hugoserver-1 {
    cd ~/path/to/1
    hugo server --buildDrafts --watch --verbose --source="/path/to/1" --config="/path/to/1/config.toml" --port=1377
    }

    function hugodeploy-1 {
    cd /path/to/1
    rm -rf /tmp/mysite.com
    chmod -R 755 /path/to/1/static/
    echo "GENERATING..."
    hugo --config="/path/to/1/config.toml" --baseURL="http://mysite.com" -s /path/to/1/ -d /tmp/mysite.com
    echo "SYNCING..."
    /path/to/rsync -avz --delete --iconv=UTF-8-MAC,UTF-8 --exclude '.well-known' /tmp/mysite.com/ myuser@remote-web-host.com:/home/myuser/path/to/1
    }