Evolution of my link roundups
As you may have noticed, I'm a fan of link compilation digests.
However, compiling them was quite the work for me. I always found interesting links during the week, then had to reserve an hour in the weekend to prepare the blogpost, which sometimes I did not had.
Furthermore, this format was flooding my blog with link roundups, which is not very user friendly for somebody who stumbles upon my front page.
I needed something better in two ways. First, the link publication has to be on the spot. Adding them to a list, then editing a post was not cutting it. Second, the links need to be their own section, independent from the rest of blog posts.
Fortunately, one of my link sources had the solution in front of me. The idea behind it is very simple and I got inspired by waxy's implementation. A box with links in the front page, and a special page only with links.
So this weekend project has been a very nice 1-line patch to bashblog, a bit of messing with postfix to parse links received to a special inbox, and some glue on top of it. I'm happy with the result!
The links index page is very crude right now. There is no CSS, and no feed available, but that will come soon. Meanwhile, feel free to bookmark it and visit it sometime!
Bashblog now supports tags
Motivated by some friends generating activity at Github I decided to add one of the main missing issues of bashblog: support for tags, or categories, whichever name one prefers.
It turned out to be a bit of work because I had to do some tricks to process comma-separated words, but in the end the result is nice enough. Now, a line accepting tags is displayed at the bottom of each post, and it automatically creates new tag archive files and links them from posts.
This doesn't break compatibility with previous posts, but unfortunately adding categories to old entries needs to be done manually. Here's how. For each post:
- Run
./bb.sh edit post.html
- You will see a full HTML file. Don't panic! Look for a line which says
<!-- text end -->
. It is always after the content of the post. - Open a new line above that one, and paste the following template:
<p>Tags:
<a href="tag_tagname.html">tagname</a>
</p>
- Replace
tagname
(both occurrences) with the desired name for the tag - The part in bold represents one tag. Copy and paste as many as you want
between
<p>
and</p>
, separating them with commas. - Make sure that all the tag information is on a single line
When you are done editing the desired posts, run ./bb.sh rebuild
and voila!
The tag files will be generated.
Don't edit html files manually! Always use bb.sh edit
since it keeps the
file timestamp, which is necessary for storing the blogpost dates.
Tags: bashblog
Creating a simple blog system with a 500-line bash script
Update: the script is now at a github repo!
One of the drawbacks of data analysis is that sometimes there is a task that blocks you and you need to wait for a couple of days to continue working on that project. Yes, there are more projects, and there's always papers to read, but it's fun to start small projects that can be finished in an afternoon—let me clarify: a long afternoon.
So here it is, BashBlog v1.0, a Bash script that handles blog posting. It features:
- Simple editing of the posts with your favorite text editor
- Transformation of every post to its own html page, using the title as the URL
- Generation of an index.html file with the latest 10 posts
- Generation of an RSS file! Blog's magic is the RSS file, isn't it...?
- Generation of a page with all posts, to solve the index.html pagination problem
- Rebuilding the index files without the need to create a new entry
- Google Analytics support
- Auto-generated CSS support
- Headers, footers, and in general everything that a well-structured html file has
- xhtml validation, CSS validation, RSS validation by the w3c
- Everything contained in a single 500-line bash script!
- A simple but nice and readable design, with nothing but the blog posts
What doesn't it support? Of course, comments. Comments would greatly increase the code complexity, would require a strong antispam system to avoid flooding and might pose a security issue on the server. So sorry, but no comments, at least until I have another free afternoon waiting for some computations to finish.
I wanted to post something to celebrate the grand opening, and what's better than a meta post explaining the script that generates this blog?
In the future I'll post some scientific tips or tutorials which don't really fit on the home page and maybe some rants about my work. To end up, if you are interested in bioinformatics or general science computing, check the unix section of my home page for more tips, tutorials, FAQs and cheat sheets.
I won't post with any periodicity, so you can always subscribe to the RSS feed to get the updates delivered to you when they're generated.
Hope to have you around sometime!
Edit: If you use the script for your own blog, please send me an email with your suggestions or drop me a comment on Twitter! It will be much appreciated and, until comments are implemented, the only way to provide feedback
Tags: bashblog