television

Television Station GTV9 Melbourne Australia

A collection of images, stories and memories.

Home 1956_1969 1970_1979 Reunions Stories Contact

Create a new post using terminal.

Navigate to the folder containing your Hugo content files.

cd /

cd your_hugo_folder/content

ls -l

Verify that you have a “posts” folder, note that the folder name is “posts” plural.

cd /

cd your_hugo_folder

andrew$ hugo new posts/creating-a-post.md

cd content

cd posts

ls -l

Rename the file creating-a-post.md to index.md

mv creating-a-post index.md

Create a new directory:

mkdir creating-a-post

Move the file index.md into the folder creating-a-post

sudo mv index.md creating-a-post

cd /creating-a-post

ls -l

Add to the folder creating-a-post any images that you will need.

ls -l

You should see your new post listed as index.md, together with the images you have added.

Place this code in your post where you want the image to appear.

{{/< img src="posts.png” alt="Creating-a-post” >/}} without the / /

Creating-a-post

Note: There is an easier way to do this using a script. So create a clickable script by following the post on this site, and paste this code.

cd / cd hugo_folder/content/posts

name="$(osascript -e ‘Tell application “System Events” to display dialog “Enter the post name:” default answer “"’ -e ‘text returned of result’ 2>/dev/null)” if [ $? -ne 0 ]; then # The user pressed Cancel exit 1 # exit with an error status elif [ -z “$name” ]; then # The user left the project name blank osascript -e ‘Tell application “System Events” to display alert “You must enter a project name; cancelling…” as warning’ exit 1 # exit with an error status fi

sudo mkdir -p $name touch index.md sudo cp /hugo_folder/themes/hugo-kiera/archetypes/posts-create.md index.md sudo cp index.md $name rm index.md sudo chown -R username:staff /hugo_fo/content/posts

Creating a Post - Hugo

Create a new post using terminal.

Navigate to the folder containing your Hugo content files.

cd /

cd your_hugo_folder/content

ls -l

Verify that you have a “posts” folder, note that the folder name is “posts” plural.

cd /

cd your_hugo_folder

andrew$ hugo new posts/creating-a-post.md

cd content

cd posts

ls -l

Rename the file creating-a-post.md to index.md

mv creating-a-post index.md

Create a new directory:

mkdir creating-a-post

Move the file index.md into the folder creating-a-post

sudo mv index.md creating-a-post

cd /creating-a-post

ls -l

Add to the folder creating-a-post any images that you will need.

ls -l

You should see your new post listed as index.md, together with the images you have added.

Place this code in your post where you want the image to appear.

{{/< img src="posts.png” alt="Creating-a-post” >/}} without the / /

Creating-a-post

Note: There is an easier way to do this using a script. So create a clickable script by following the post on this site, and paste this code.

cd / cd hugo_folder/content/posts

name="$(osascript -e ‘Tell application “System Events” to display dialog “Enter the post name:” default answer “"’ -e ‘text returned of result’ 2>/dev/null)” if [ $? -ne 0 ]; then # The user pressed Cancel exit 1 # exit with an error status elif [ -z “$name” ]; then # The user left the project name blank osascript -e ‘Tell application “System Events” to display alert “You must enter a project name; cancelling…” as warning’ exit 1 # exit with an error status fi

sudo mkdir -p $name touch index.md sudo cp /hugo_folder/themes/hugo-kiera/archetypes/posts-create.md index.md sudo cp index.md $name rm index.md sudo chown -R username:staff /hugo_fo/content/posts