Hey everyone! As you all know, I've been doing tons of work on the website lately, and I've redesigned and rewritten it from scratch like three times over the past few weeks, with more changes and another potential rewrite on the way!
Anyways, what's changed today? Well, there's been some frontend changes, but more importantly, I've done some technical changes behind the scenes which make my life so much easier. Let me elaborate -
- Frontend Changes - I've done some small changes to the CSS this week, as you may have noticed. The font has changed, the content now fills the screen instead of being small and centered, the sidebar style has been changed. Also, the social media icons in the footer now expand up up to 350% when you hover over them, instead of the 20% it was at previously. Now onto the technical stuff -
- Dynamic Sidebar - If you're on desktop, you may have noticed the "Blog Posts" section in the page's sidebar. Now what you may not have known, unless you snuck into the source code, is that the values were in fact hard-coded! Now this wasn't that big of a deal, but as the website grows bigger and more pages and blogs are added, it'll become near impossible, or at the very least extremely inefficient, to manually modify every single page's sidebar, not to mention very prone to error. However, I found a simple solution to the problem using some JavaScript magic - I made an array to contain all of the page's posts, and then when the page loads, the browser loops through the array and automatically appends all of those blog posts to the sidebar. Now at the moment, this functionality is only for the sidebar's blog post section, but soon, It'll be implemented in the navbar, footer, and other sections in the sidebar!
- Blog Changes - Now you guys probably didn't notice anything different about this blog, apart from the date format, which I had to change to make this feature work (or at least make it easier for myself). I haven't changed much on the frontend, but there's some secret stuff happening behind the scenes. Before, all the posts were hardcoded HTML files. Which means I had to copy+paste one of my blogs, and then do some minor changes, such as updating the content. However, I decided to change that completely. Now, the method to add new blogs is completely different! First off, I'm not even writing this in an HTML file, this is actually being written in a markdown (.md) file, which is being saved in the "/blog_generator/posts/" folder. Once I finish writing this, I just need to simply run the Python file that I created, and what it'll do is loop through all of the files in the "/blog_generator/posts/" folder, use them to create an HTML file based on a provided boilerplate markdown file (I didn't use an HTML file for this as I didn't want the user to be able to open it as a page), and save the new HTML file in the "/posts/" folder. It also has some other cool features, like detecting the first line of the .md file as the title, getting the date from the computer, and not overwriting existing blog files, and it's only around 100 lines of code! This generator is open sourced, just like the rest of the site, so if you guys are curious, you can check it out and/or contribute. Here's the GitHub link.
Anyways, that's all from me for now, it's pretty late here, (as I'm writing this blog, It's 12:04 AM) so I'll see you guys next time! Feel free to drop me suggestions on my Discord and make sure you drop in to watch the development live on my Twitch channel.