|
| 1 | +--- |
| 2 | +title: What is blog-tools? |
| 3 | +date: 2025-07-23 |
| 4 | +categories: |
| 5 | + - Blog |
| 6 | + - blog-tools |
| 7 | +tags: |
| 8 | + - blog-tools |
| 9 | + - blog |
| 10 | + - ruby |
| 11 | + - gem |
| 12 | +description: What is the blog-tools gem, and why I decided to make it |
| 13 | +--- |
| 14 | + |
| 15 | +## The Issue |
| 16 | +Okay, so I manage this blog by myself, and it can get tedious at times, trying to remember all of the things I was to write about, making sure I'm using a consistent style as I set up my posts, etc and etc. |
| 17 | + |
| 18 | +And while yes I'm sure there are plugins on Obsidian for all of my issues, but I don't really learn anything from just installing the nth plugin. |
| 19 | + |
| 20 | +### What I Need |
| 21 | +So what do I need? Well, I'm going to start with the following: |
| 22 | +- The ability to create posts off of templates and edit only the features i need to edit |
| 23 | +- The ability to have lists of the posts that I want to write in the future. |
| 24 | + |
| 25 | +### Previous Solutions |
| 26 | +Now, I have made scripts that can take care of those for me, but they are rudimentary and not very flexible. The first script I made was for keeping track of my writeups to do, and looks like this: |
| 27 | + |
| 28 | +```sh |
| 29 | +# Writeup function |
| 30 | +function writeups() { |
| 31 | + if [ "$1" == "-s" ] || [ "$1" == "--short" ]; then |
| 32 | + echo "Type 'writeups' to see writeups that still need to be completed" |
| 33 | + output=$(writeups) |
| 34 | + count=$(echo "$output" | wc -l) |
| 35 | + echo "Current count: $count" |
| 36 | + return |
| 37 | + fi |
| 38 | +echo "Challenge name - CTF" |
| 39 | +echo "Challenge name - CTF" |
| 40 | +echo "Challenge name - CTF" |
| 41 | +echo "Challenge name - CTF" |
| 42 | +echo "Challenge name - CTF" |
| 43 | +echo "Challenge name - CTF" |
| 44 | +echo "Challenge name - CTF" |
| 45 | +echo "Challenge name - CTF" |
| 46 | +echo "Challenge name - CTF" |
| 47 | +echo "Challenge name - CTF" |
| 48 | +echo "Challenge name - CTF" |
| 49 | +echo "Challenge name - CTF" |
| 50 | +echo "Challenge name - CTF" |
| 51 | +echo "Challenge name - CTF" |
| 52 | +echo "Challenge name - CTF" |
| 53 | +echo "Challenge name - CTF" |
| 54 | +echo "Challenge name - CTF" |
| 55 | +echo "Challenge name - CTF" |
| 56 | +echo "Challenge name - CTF" |
| 57 | +echo "Challenge name - CTF" |
| 58 | +echo "Challenge name - CTF" |
| 59 | +echo "Challenge name - CTF" |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +As you can see, it got out of hand really quickly, with enough writeups on the to-do list, it becomes an unsightly chore to deal with. |
| 64 | + |
| 65 | +The other thing I needed was some way to standardize the front matter of my posts. If you don't know already: Jekyll is a static-site generator, and in my case I make my posts in markdown files, and then it generates the `html` from that. The way I'm able to get the tags, and categories and everything is through something called `front matter`. It is a `YAML` block that looks similar to this: |
| 66 | + |
| 67 | +```markdown |
| 68 | +--- |
| 69 | +title: What is blog-tools? |
| 70 | +date: 2025-07-23 |
| 71 | +categories: |
| 72 | + - Blog |
| 73 | + - blog-tools |
| 74 | +tags: |
| 75 | + - blog-tools |
| 76 | + - blog |
| 77 | + - ruby |
| 78 | + - gem |
| 79 | +description: What is the blog-tools gem, and why I decided to make it |
| 80 | +--- |
| 81 | +``` |
| 82 | + |
| 83 | +Now, in order to make viewing my blog more pleasant for you guys, I need to make sure to properly tag and categorize all of my posts. Since most of my posts are writeups for the CTFs I do, I've only made a tool for that, and it actually serves me quite well. |
| 84 | + |
| 85 | +```sh |
| 86 | +function blog-header() { |
| 87 | + if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then |
| 88 | + echo "Usage: ${FUNCNAME[0]} [CTF Name] [Category Name] [Challenge Name]" |
| 89 | + return |
| 90 | + fi |
| 91 | + |
| 92 | + echo "---" |
| 93 | + echo "title: $3" |
| 94 | + echo "date: $(date -I)" |
| 95 | + echo "categories: [Capture The Flags, $1]" |
| 96 | + echo "tags: [ctf, ${1,,}, ${2,,}, writeups]" |
| 97 | + echo "description: $1 $3 Challenge" |
| 98 | + echo "---" |
| 99 | + echo "" |
| 100 | + echo "" |
| 101 | + echo "> Challenge description:" |
| 102 | + echo "> " |
| 103 | + echo "> " |
| 104 | + echo "{: .prompt-info }" |
| 105 | +} |
| 106 | +``` |
| 107 | + |
| 108 | +But as I write about more and more things, keeping track of an alias for every different type is going to get to be too complicated. So I'm in need of a better idea. |
| 109 | + |
| 110 | + |
| 111 | +## The Solution |
| 112 | +Introducing `blog-tools`, my attempt at solving all of my issues, and hopefully someone else's issues too. |
| 113 | + |
| 114 | +Here are my goals for the project: |
| 115 | + |
| 116 | +### Maintaining Lists of Ideas |
| 117 | +So like I said earlier, I need a way to keep track of all of my different ideas and future plans for posts. What I was thinking was having a way to create a list, add ideas to it, and then add information to those ideas, such as what the tags are going to be, or who the author is, or where the post's content is located with the filesystem. I'd also want to be able to track the status of posts, mark them complete or in progress if needed. |
| 118 | + |
| 119 | +### Generating Writeups |
| 120 | +Alright, so like I had with the front matter, I would want to be able to generate posts using templates, and just have a single template per type of post, rather than have a whole entire command for each type of template. Another cool thing to have would be the ability to generate posts based on the lists we create, and use the information stored in those, like tags and path, to help with the generation. |
| 121 | + |
| 122 | +## blog-tools |
| 123 | +### Why Ruby? |
| 124 | +I like Ruby, and want to get better at using it to make CLI applications, so it seemed like an obvious choice. I also wanted to create a gem, so its just another reason to make this in Ruby. |
| 125 | + |
| 126 | +### The Future |
| 127 | +So now, with my ideas in hand, I'll start working on my new project. I will be documenting my work here as I go. Stay tuned for other things, and make sure to leave a comment if you want a specific feature or improvement to the project. |
| 128 | + |
| 129 | +The repository is hosted on [GitHub](https://github.com/Slavetomints/blog-tools) |
| 130 | + |
| 131 | +And you can find the page on [RubyGems](https://rubygems.org/gems/blog-tools) |
0 commit comments