Skip to content

HaoboGu/hugo-alfred-workflow

Repository files navigation

hugo-alfred-workflow

Alfred workflow for Hugo, a static site generator.

This workflow provides shortkey for markdown document to hugo post migration, creating new hugo post and one-click deployment.

Usage

If you do not know hugo, please check https://gohugo.io/getting-started/.

Set hugo source folder

First you should set your hugo source folder using hugoset:

image-20190821210929425

This command will set this folder's path in environment variables.

If your source folder is changed, you must set it again.

Markdown document migration

If you want to migrate your existing markdown docs to hugo posts, use hgtran:

image-20190821211256084

Then this file will be copied to hugo-source-folder/content/posts/ and a simple hugo front matter will be added to the head of the post file. The post file will be automatically opened for you:

image-20190821211654105

Create a new hugo post

You can create a new hugo post using hgnew:

image-20190821211811136

Note that you CANNOT use filenames with whitespaces here. Pleaee use - to replace whitespaces -- don't worry, those - will be replaced by whitespaces in the post title.

Similarly, the created file will be opened automatically with a simple hugo front matter:

image-20190821212024203

Deploy

Before deploy your site, make sure you have deploy.sh in your hugo source folder and you can deploy your site using ./deploy.sh in the root of your hugo source folder. Please check hugo's official doc first.

Use deploy in Alfred to deploy your site:

image-20190821212321837

The Alfred will automatically open the terminal and run the deploy script:

image-20190821212432042

Contribution

This workflow is in a very early stage, any kinds of contribution are welcome!

Please feel free to open an issue if you have any questions or suggestions!

About

Alfred workflow for Hugo, a static site generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages