We have #hashtags

Now that I have a few varied posts, I thought it’s about time I started to look at categorising these entries.   My original plan was to create a new table to store the categories in the way you would expect with a normalised database. Then it occurred to me, if it’s good enough for twitter, it should be fine for my little humble site.  I’ll use these new-fangled things called hash tags. 

Using php regular expression, whenever there is a word with a #hash in front it, my code will wrap a hyperlink round it.  Clicking this link will then return a list of posts that contain the same #hash tags.  This does a query against the database using LIKE ‘%#hash%’, so no need for a separate table. Let’s see how it performs after a few thousand posts! (HA, like I’ll ever get to that point!)



Back to blog