Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom config file name and publishdir #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ $ git push heroku master
$ heroku open
```

Environment Variables
===

To use a custom config file name or `publishdir` you can use these environment variables:

```bash
$ heroku config:set HUGOCONFIG="config_de.toml"
```

```bash
$ heroku config:set HUGOPATH="public/custom"
```


Legacy Compatibility
===

Expand Down
11 changes: 9 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ if [ -e $BUILD_DIR/.hugotheme ]; then
git clone $THEME_URL
fi

# Fetch config file
if [ -z "$HUGOCONFIG" ]; then
CONFIG_FILE="`ls $BUILD_DIR | grep config | head -n1`"
else
CONFIG_FILE="$HUGOCONFIG"
fi

# Build the site
echo "\n-----> Building the site"
echo "\n-----> Building the site with config file $CONFIG_FILE"
cd $BUILD_DIR
mkdir -p static | indent
./hugo | indent
./hugo --config="$CONFIG_FILE" | indent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./hugo $CONFIG_FILE | indent

8 changes: 6 additions & 2 deletions bin/detect
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

BUILD_DIR=$1

CONFIG_FILE="`ls $BUILD_DIR | grep config`"
if [ -z "$HUGOCONFIG" ]; then
CONFIG_FILE="`ls $BUILD_DIR | grep config | head -n1`"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize $CONFIG_FILE to an empty string, then remove this branch entirely.

else
CONFIG_FILE="$HUGOCONFIG"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONFIG_FILE="--config $HUGOCONFIG"

fi

if [ -z $CONFIG_FILE ]; then
if [ -z "$CONFIG_FILE" ]; then
echo "\n-----> Hugo expects to find a config file in the root of the source directory! please include a config.toml, config.yaml or config.json file"
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion bin/release
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/sh
if [ -z "$HUGOPATH" ]; then
HUGOPATH="public"
fi

cat << EOF
---
default_process_types:
web: "cd public && python -m SimpleHTTPServer \$PORT"
web: "cd \$HUGOPATH && python -m SimpleHTTPServer \$PORT"
EOF