ch-ch-ch-changes
							parent
							
								
									4b799d2039
								
							
						
					
					
						commit
						69ab712c40
					
				| @ -0,0 +1,9 @@ | ||||
| --- | ||||
| title: Composer Test | ||||
| layout: post | ||||
| date: 2022-08-25 20:30:23 | ||||
| excerpt_separator: <!--more--> | ||||
| --- | ||||
| 
 | ||||
| I wrote a "composer" for my blog...a script that generates a file with front matter and handles moving it to the proper directory. I found I needed to add a time-stamp to all my posts so they'd | ||||
| display in the right order. So in the process, I made it do a bunch of other stuff. I'll do a proper write-up on it later. I've got stuff I want to do. | ||||
| @ -0,0 +1,8 @@ | ||||
| --- | ||||
| title: Composer Test for /pbx | ||||
| layout: post | ||||
| date: 2022-08-25 20:16:12 | ||||
| excerpt_separator: <!--more--> | ||||
| --- | ||||
| 
 | ||||
| This is a test article for /pbx. I will delete it in a future push. | ||||
| @ -0,0 +1,8 @@ | ||||
| --- | ||||
| title: Composer Test for /dev | ||||
| layout: post | ||||
| date: 2022-08-25 20:16:50 | ||||
| excerpt_separator: <!--more--> | ||||
| --- | ||||
| 
 | ||||
| This is a test post for /dev. I'll delete it when I do a full write up. | ||||
| @ -0,0 +1,38 @@ | ||||
| #!/bin/bash | ||||
| # pickmy.org post composer | ||||
| # by: Jay/nq4t/@music_onhold | ||||
| 
 | ||||
| # usage: ./compose.sh [category] [title] | ||||
| # example: /compose.sh blog MY AWESOME BLOG TITLE NO YOU DON'T NEED TO ENCLOSE IT! | ||||
| # run in the root of your site files/repository | ||||
| # assumes categories are directories in root | ||||
| 
 | ||||
| # Arguments and Variables | ||||
| category=$1 | ||||
| pd=$(date +'%Y-%m-%d') | ||||
| pt=$(date +'%T') | ||||
| file=blog$$.md | ||||
| title=$2 | ||||
| # I'm lazy. I want every indvidual word after | ||||
| # the first one to be the title. No special | ||||
| # characters. Just cycle through them. | ||||
| shift 2 | ||||
| for word in "$@" | ||||
| do | ||||
| title="$title $1"; | ||||
| shift 1; | ||||
| done | ||||
| 
 | ||||
| # Let's write the front matter to our file. | ||||
| 
 | ||||
| printf -- "---\ntitle: $title\nlayout: post\ndate: $pd $pt\nexcerpt_separator: <!--more-->\n---\n" >> $file | ||||
| 
 | ||||
| # Write the post in nano. | ||||
| 
 | ||||
| nano + $file | ||||
| 
 | ||||
| # Rename the file and copy the post to the right directory. | ||||
| 
 | ||||
| t=${title,,} | ||||
| mv $file $category/_posts/$pd-${t// /-}.md | ||||
| printf "\nPost $title created in $category: $category/_posts/$pd-${t// /-}.md\n\n" | ||||
| @ -0,0 +1,7 @@ | ||||
| --- | ||||
| title: Composer Test | ||||
| layout: post | ||||
| date: 2022-08-25 20:25:37 | ||||
| excerpt_separator: <!--more--> | ||||
| --- | ||||
| This is a composer test. I will delete it later. | ||||
| @ -0,0 +1,7 @@ | ||||
| --- | ||||
| title: Composer Test | ||||
| layout: post | ||||
| date: 2022-08-25 20:26:15 | ||||
| excerpt_separator: <!--more--> | ||||
| --- | ||||
| This is a composer test. I will delete it later. | ||||
					Loading…
					
					
				
		Reference in New Issue