Categories
Online Marketing

lb: Blog System in Less Than 100 Lines of Shell Script!

So especially now that I’m starting my dissertation and I’m going to be like I’m basically going to be a neat like I don’t have to go to classes or anything at a daily basis, so it’d be nice to keep myself on task now.

I am NOT a big fan of a lot of blogging software out there. You know, I don’t want to use WordPress or anything. That’s too bloated. I want to have something that just generates HTML pages, really simply not even a static page generator, just something. That’s very. Like makes sense, I don’t have to you know, write anything and markdown and convert it to HTML and do all the silly stuff. So I ended up writing a little blog system that might be worth checking out if you’re interested, so it’s actually written in less than a hundred lines of shell script.

In fact, I think it’s. If I actually look at it, I think it’s considerably less yeah. It’s just 71 lines, that’s all you need, but it does everything that I need and it gives you some nice different interfaces that might be interesting. Let me show you how it looks on my website so right now. I just have it here so they’re different in are different ways of looking at it, so the pH I’ve linked here is a rolling blog page, and this is originally the only thing I wanted, but it has other stuff that, in addition to this – and that is When I put up in a blog entry, it appears here as a you know, a new entry, of course they’re in chronological order, auto generates the date, gives me a title.

One of the nice things at is it generates links so it generates. The first link is like a link to the header, so if I click on this link, it actually takes me directly to the header and of course you can copy this, I’m not even on my website, I’m on the offline one, but it doesn’t matter, but you Can just copy the HTML that it generates in the standalone link if you want to link directly to that entry, so you can just copy this share it with some Linnell and it goes directly to that entry.

As you know, you probably have seen in other sites, but it’s nice having this automatic um. Additionally, in addition to that, it generates a link to a standalone page. So if you just want to view one alone, you can do that just as well. Now I don’t have the kind of thing where, like it cuts off after a point, I might integrate that later. But really my goal like what I want to have like what I like in blogs is when they’re just everything is just on one page and if you only use plain text, it doesn’t really get that big.

So my idea is like write, my blog page here. This isn’t part of the system necessarily, but mine is 2008. The HTML and my idea is after 2008 I’ll start using 2009 or something like that. That way, the pages don’t get too big, but my idea is like on this page. Everything should be there, but you know if you don’t like it, you can probably change the the script around, but so it generates these links that generates standalone pages and stuff, like that it also when you finalize a link, it automatically R adds it to the RSS Feed, so you can check my RSS feed and you’ll see that all the syntax is actually here as well.

Actually, let me just open up my RSS feed manually, so you’ll see that it generates it. Of course it takes that AIT’s HTML takes all the metadata. It needs and puts it into some kind of you know, gives it a unique ID the date it’s stuff like that, then it needs to be read properly by RSS readers, so all of that is like totally automatic. Let me show you how you actually use oh and the other interface I should say, which is something I’ve been playing around.

I don’t know if you checked out my website recently, but I’ve been playing around with this for other stuff. Like you know, Apache has this. You know we’re all familiar with it. Probably, but people don’t use them much, often like where a putt Apache can just generate the directory contents for a folder. So you can see the content of the contents of my proto-indo-european folder here. But the same thing is true: if the blog posts, so you can go to slash blog and these are actually out of order because I’ve been playing around with them, but if you don’t mess around with them since you’re, not figure out the cyst like, I am It’ll automatically add them and you can list them in chronological order or something like that, if you don’t know how to do this, for you know, Apache just look up how to make an Apache.

What is it like indexes or something like that? But anyway, so how does this blog system actually work? What’s the actual interface, so I’m going to go to my website directory and you’ll, see here the script here lb. That’s the name of my blog system is symlink. T’, so if you just run it by default, it gives you some directions, but I’ll talk about those in a second to add a new entry. It really just has three commands new finalize and delete so new.

It asks for a title. Let’s say you know, this is a blog post title and you go into it opens up, I think, and it might be vim. I might want to change it to your default editor, but it opens up. You know a page where you can actually add the content. So this is the content and of course this is you know it’s just an HTML, so you can do whatever you want here, save that and now, when you’re done, modifying the file, it’s actually stored, as it says here, it’s stored in a slash blog, slash, dot Drafts now, if you want to get rid of that draft, all you have to do is just RM it.

That’s all you have to do, but if you want to finalize it, what you should do is run lb finalize and that will give you a list of all your drafts. Currently I just have one so I’m going to pick that one and it’s now finalized. Now what that means is, it adds it first off to the HTML like rolling blog page. So here it is here. This is the content artists that are generally a standalone page. This is the content average of that nice and simple.

As the author name below and stuff on the standalone page – and it also it’s not going to work on my URL link, but I can because I haven’t updated my website. But if I go to my RSS feed offline you’ll see that here it’s all been added to the RSS feed, read the RSS feed or whatever. So all of that is automatic. Now, let’s say this is just in an example. I don’t actually want to push this to my website, so what you can do is just run lb delete to delete an old post and that generates a list of all the posts that you have, and I want to get rid of.

I should probably have this ordered chronologically. That would be a little easier, but yeah I’ll do that in a second. So all you have to do is select the one you want to get rid of say yes and then it actually it deletes the file. The standalone file – and it also deletes all that information from the RSS feed and the rolling blog page. So if I go back to this this, that entry is now going to be gone.

Okay, so that’s pretty much all the system. Does it again? It’s really simple! You just create blog posts and it’ll, convert it to RSS syntax and whatever else you need, if you want to delete a post, it will do that automatically. So one thing the one thing it doesn’t do since it’s not like a database or it doesn’t generate pages on the fly is: if you want to modify a post, you would basically have to modify the standalone page and the you know the the rolling blog list And the RSS feeds separately – that’s not the intended interface just because, and it would probably be a little more difficult to add something like that.

Just because there can be there can be a lot that varies between files. So I mean I I’m the kind of person I don’t like revise things like, I don’t believe in correcting spelling checks, there’s spelling mistakes or whatever. So I don’t care, but you know whatever, so it might not be for you if you’re the kind of person who is like that. That’s what I’m trying to say um and the last thing is what is the last thing just two seconds ago in my head, I was like.

Oh, I got ta say this one more thing. What what is the the last thing? I have to say. I don’t know, maybe that is it I’m going to forget, I’m going to turn off the camera and come back in a second. When I remember okay, I remember the last thing is the the other things it’s sort of important to remember is like when it’s generating these entries in the web, like the rolling blog page. All of this is like I mean it actually creates.

If you look at the source of it, it is a div of the class entry or something like this, so all the user interface or not user interface. All the decoration. I have like the fact that this is a slightly darker gray and the the sidebar here. All of that is just CSS, so for a lot of this stuff, if you want like a your blog to look totally different from mine, you can change it all the stuff like how Andrew individual entries look or how you know if you want them all as Individual squares on a page or something something totally unreadable, all of that’s a possibility.

All the thing does and well I should say you can go into the actual script and change any number of variables of the things you know that are at stake. So, of course you know here you can set your individual website, which is obviously not the same as mine you’re, going to want to change that or the stuff up here. You can also change, I think, yeah things like the header or the footer to the the individual page, the date that is displayed on the website.

This stuff is lower down because it has to be called lower down, but yeah, so you can play around with it again. It is less than 75 lines, so it doesn’t have all the functionality and that again it can’t, like you know, like change the content. I’ve already published blogs unless you want to do it manually, but yeah I’ve really enjoyed like this is pretty much all I need for a blog, so it’s probably the kind of stuff I’m going to be using so anyway, but that’s about it and I’ll see you Guys next time hope you learn something


Don't have time to do the blogging thing?

Maybe Copywriting services are for you.

 

 

By Jimmy Dagger

Find out my interests on my awesome blog!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.