parent
4fb9ecd5a7
commit
a90e7c80bb
@ -0,0 +1,32 @@
|
||||
#! /bin/sh
|
||||
|
||||
title=""
|
||||
author=""
|
||||
tags=""
|
||||
folder_name=""
|
||||
# Get current date
|
||||
date=$(date +%Y-%m-%d)
|
||||
|
||||
read -p "Enter new blog title: " title
|
||||
read -p "Enter author's name: " author
|
||||
read -p "Enter tags (seperated by spaces): " tags
|
||||
|
||||
# Replace spaces with dashes for tags
|
||||
tags=$(echo $tags | sed -e 's/ /,/g')
|
||||
|
||||
# Convert to lowercase, trim non-alpha characters and replace spaces with dashes for folder name
|
||||
folder_name=$(echo $title | tr '[:upper:]' '[:lower:]' | sed -e 's/ /-/g' | sed -e 's/[,.!]//g')
|
||||
|
||||
folder_path="src/blog/$folder_name"
|
||||
|
||||
# Create folder
|
||||
mkdir -p $folder_path
|
||||
# Flush metadata to the new blog file
|
||||
printf "title: $title
|
||||
author: $author
|
||||
date: $date
|
||||
tags: $tags
|
||||
----
|
||||
" >> $folder_path/index.md
|
||||
|
||||
echo "New blog created at $folder_path"
|
@ -0,0 +1,6 @@
|
||||
|
||||
title: Hello, World!
|
||||
author: VnPower
|
||||
date: 2022-08-09
|
||||
tags: hello,testing
|
||||
----
|
@ -1,8 +0,0 @@
|
||||
title: New blog
|
||||
author: VnPower
|
||||
date: 2022-08-09
|
||||
tags:hello
|
||||
----
|
||||
|
||||
# OMG!
|
||||
Hello!
|
@ -1,17 +0,0 @@
|
||||
title: Test
|
||||
author: VnPower
|
||||
date: 2022-07-09
|
||||
tags: code, rust
|
||||
----
|
||||
|
||||
# Hi? Overflow testing
|
||||
|
||||
asd
|
||||
|
||||
```rust
|
||||
fn greet() {
|
||||
println!("Hi there!");
|
||||
}
|
||||
|
||||
let x = 69;
|
||||
```
|
Loading…
Reference in new issue