First setup of the blog
First article and about page Flex theme setup with some corrections and using a PR for ToC
This commit is contained in:
commit
8ec9e39f3c
13 changed files with 256 additions and 0 deletions
44
new_article.sh
Executable file
44
new_article.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Add the metadata if the answer is not empty
|
||||
# Usage:
|
||||
# append_to_metadata file_name metadata_name
|
||||
append_to_metadata() {
|
||||
if [ $# -eq 2 ]; then
|
||||
echo -n "$2 : "
|
||||
read answer
|
||||
if [ -n "$answer" ]; then
|
||||
echo "$2: ""$answer" >> "content/articles/$1"
|
||||
else
|
||||
echo "Empty answer, nothing was appended"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo -n "Filename : "
|
||||
read filename
|
||||
|
||||
append_to_metadata "$filename" "Title"
|
||||
|
||||
append_to_metadata "$filename" "Date"
|
||||
|
||||
append_to_metadata "$filename" "Category"
|
||||
|
||||
append_to_metadata "$filename" "Tags"
|
||||
|
||||
append_to_metadata "$filename" "Lang"
|
||||
|
||||
append_to_metadata "$filename" "Slug"
|
||||
|
||||
append_to_metadata "$filename" "Summary"
|
||||
|
||||
echo -e "\n" >> content/articles/"$filename"
|
||||
|
||||
# Try to get the default editor from alternatives
|
||||
EDITOR=${EDITOR:-$(update-alternatives --list editor | head -n1)}
|
||||
# If not present set it to vi
|
||||
EDITOR=${EDITOR:-vi}
|
||||
|
||||
# Open the newly created file, openfully in the chosen editor
|
||||
|
||||
$EDITOR content/articles/"$filename"
|
Loading…
Add table
Add a link
Reference in a new issue