x
This website uses third party cookies exclusively to collect analytics data. If you continue browsing or close this notice, you will accept their use. The EU now requires all sites to display this banner which confuses users and does nothing, actually, to improve your privacy.
Read more on why this law is ignorantLearn about this website's cookiesDisallow cookies
Carlos Fenollosa

Carlos Fenollosa

Engineer, developer, entrepreneur

Carlos Fenollosa — Blog

Thoughts on science and tips for researchers who use computers

Bashblog now supports tags

February 27, 2014 — Carlos Fenollosa

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:

  1. Run ./bb.sh edit post.html
  2. 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.
  3. Open a new line above that one, and paste the following template:
    <p>Tags:<a href="tag_tagname.html">tagname</a></p>
  4. Replace tagname (both occurrences) with the desired name for the tag
  5. The part in bold represents one tag. Copy and paste as many as you want between <p> and </p>, separating them with commas.
  6. 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

Comments? Tweet  

Creating a simple blog system with a 500-line bash script

September 20, 2011 — Carlos Fenollosa

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

Comments? Tweet