Now if I can only automate _writing_ them, too :PattemptAtTagsRenovation
parent
dc4320ac19
commit
4e2da707fc
@ -1,5 +1,5 @@ |
|||||||
Content is stored in `blog/`. All commands below should be executed from there. |
Content is stored in `blog/`. All `hugo` commands below should be executed from there. |
||||||
This top-level directory is just for package metadata, `README.md`, etc. |
This top-level directory is just for package metadata, `README.md`, etc. |
||||||
|
|
||||||
* To create a new post, run `hugo new posts/<name>.md` |
* To create a new post, run `hugo new posts/<name>.md` (or, run `np.sh <name>` _from the root directory_) |
||||||
* To start a local server to check how it looks, run `hugo server` (with `-D` to show drafts) |
* To start a local server to check how it looks, run `hugo server` (with `-D` to show drafts) |
||||||
|
@ -0,0 +1,27 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
postName=$1 |
||||||
|
if [ -z $postName ]; then |
||||||
|
echo "Usage: np.sh <postName>" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then |
||||||
|
echo "Expected 1 arguments but found $# - exiting" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
pushd blog > /dev/null |
||||||
|
|
||||||
|
hugo new "posts/$postName.md" |
||||||
|
outputLocation="content/posts/$postName.md" |
||||||
|
if [ -n "$EDITOR" ]; then |
||||||
|
$EDITOR $outputLocation |
||||||
|
else |
||||||
|
echo "No default editor set - falling back to Sublime" |
||||||
|
# I expect this is only ever gonna be used by me anyway, so |
||||||
|
# I might as well set my own preference as the default :P |
||||||
|
subl $outputLocation |
||||||
|
fi |
||||||
|
|
||||||
|
popd > /dev/null |
Loading…
Reference in new issue