Today I learned:

Hiding Categories from Paginator

According to the Jekyll docs, the jekyll-paginator plugin does not support categories or tags. That means there is no way to exclude a category as a whole. You can only exclude posts individually by including hidden: true in each post’s YAML front-matter.

I’m hiding all of my TIL posts from the front page of my site, so I did a global find and replace to accomplish it.

Mirror of If statement in Liquid

Liquid has a neat concept that is the inverse of an If statement. It executes if a condition is not met.

{% unless post.categories contains 'TIL' %}
	Code here to display all the things!
{% endunless %}

Inserting via mysqli()

Using the mysqli() function I wrote about yesterday, here is how to insert something into a table:

<?php
$connect = new mysqli($server, $db_username, $password, $db);
$connect->query("INSERT INTO `table_name` (username) VALUES ('$user');");

Make sure your variables are sanitized first! You don’t want someone doing a SQL injection.

Eric Davis told me that mysqli() is the old way of doing things and I should check out PDO instead.

View more TIL posts