Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created August 28, 2017 06:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Integralist/548e1d149e15003b5c799da2520ed46c to your computer and use it in GitHub Desktop.
Save Integralist/548e1d149e15003b5c799da2520ed46c to your computer and use it in GitHub Desktop.
[Hugo build script for User page] #github #hugo #build
#!/usr/bin/env bash
function contains {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
function remove_toplevel {
local blacklist=(build.sh CNAME keybase.txt src)
local trigger=0
for i in *; do
if contains "$i" "${blacklist[@]}"; then
trigger=1
echo "this is a blacklist file: $i"
else
rm -rf "$i"
fi
done
if [[ $trigger -eq 1 ]]; then
printf "\n...we won't delete these files.\n\n"
fi
}
function build_site {
pushd "./src" 1>/dev/null
hugo
cp -r ./public/ ../
popd 1>/dev/null
}
remove_toplevel
build_site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment