hugo, allow specifying the baseURL since it's helpful for SEO and other things, also rename PORT variables to not collide with Ansible's PROD_PORT.
This commit is contained in:
1 parent
a5c1eef4a8
commit
2f2484df93
5 files changed
+23
-12
No files matched your search
@@ -3,6 +3,7 @@
|
||||
cd /var/www/hugo/site
|
||||
|
||||
FORCE="$1"
|
||||
BASEURL="$2"
|
||||
|
||||
echo "*** Running cronjob @ `date` ***"
|
||||
|
||||
@@ -16,7 +17,7 @@ if [[ $status != 0 && -e /var/www/html/index.html && -z $FORCE ]]; then
|
||||
fi
|
||||
|
||||
# If the project was not already up to date, build the new files for NGINX.
|
||||
/usr/local/bin/hugo --gc --minify
|
||||
/usr/local/bin/hugo $BASEURL --gc --minify
|
||||
status="$?"
|
||||
echo "* Hugo status is '$status', FORCE is '$FORCE'."
|
||||
if [[ $status == 0 && -e public/index.html ]]; then
|
||||
|
||||
@@ -17,6 +17,13 @@ DEV="$4"
|
||||
typeset -u DEV
|
||||
echo "DEV='$DEV'"
|
||||
|
||||
BASEURL="$5"
|
||||
echo "BASEURL='$BASEURL'"
|
||||
baseurl=""
|
||||
if [[ -n "$BASEURL" ]]; then
|
||||
baseurl="-b $BASEURL"
|
||||
fi
|
||||
|
||||
SITE="/var/www/hugo/site"
|
||||
CLONE="/var/www/hugo/site-new"
|
||||
|
||||
@@ -40,7 +47,7 @@ mv -v $CLONE $SITE
|
||||
|
||||
echo "*** Copying Static Files to NGINX ***"
|
||||
rm -rfv /var/www/html/*
|
||||
sudo -u www-data /var/www/hugo/cronjob.sh
|
||||
sudo -u www-data /var/www/hugo/cronjob.sh "" "$baseurl"
|
||||
|
||||
echo "*** Starting Cron ***"
|
||||
service cron start
|
||||
@@ -73,7 +80,7 @@ if [[ "$DEV" == "Y"* || "$DEV" == "T"* ]]; then
|
||||
echo "* Dev server not detected, starting..."
|
||||
cd $SITE
|
||||
killall hugo 2>/dev/null
|
||||
sudo -u www-data hugo server -D -F --noBuildLock --bind 0.0.0.0 -p 1380 &
|
||||
sudo -u www-data hugo server $baseurl -D -F --noBuildLock --bind 0.0.0.0 -p 1380 &
|
||||
fi
|
||||
sleep 30
|
||||
done &
|
||||
|
||||
Reference in new issue
Block a user