“All the News That’s Omg Lol”

Online Edition
As if we’d actually use ink for this?

Vol. 13 of 36
January 22, 2023 8:17 PM UTC
Free

Weblog updates: some template flexibility, titleless posts, and improved Markdown parsing

Several new things in weblog.lol to talk about! Digging right in:

New default Page Template

Starting today, brand new weblogs will get a second template added by default. It’s called the Page Template and it’s a simple variant of the main template (almost identical, but with the date, tags, and recent posts bits removed). This makes it easier to have a nice appearance for your static pages that don’t necessarily need all of the weblog-specific stuff on them.

If you’d like to add this setup to your existing weblog, just create a new entry with the content from the default page template.

In addition, if you have a template called Page Template, this will be the new default template for any pages (i.e. any entries with Type: Page metadata). You’ll no longer have to specify the template manually in your entry metadata if you’d like to just use that default page template.

Templates for tag and search results pages

Weblog.lol generates two types of pages for you when needed: tag pages (what you see when you click on a tag), and search results pages (where search results are displayed). Previously, these pages would only use your weblog’s main template, but now you can specify any template you’d like. In your configuration, you can add:

Search template: Page Template

and

Tag page template: Page Template

These will default to the same page template discussed above, but you can use any template you‘d like. This is a nice way to not have weblog-specific stuff appearing on these utility pages.

Better support for titleless posts

Weblog.lol now handles posts without titles much more nicely, respecting titleless entries by no longer adding any assumed titles to feeds. Where titles need to be shown (such as in post lists, search results, etc.), a string will be shown based on a portion of the content in the post (starting at the beginning). You can control how much text is included in generating this through the new `Titleless title length’ configuration item, which can accept values in both characters or words.

For example:

Titleless title length: 15 words

or

Titleless title length: 80 characters

The logic under the hoot attempts to follow Dave Winer’s guidance and seems to work really well.

Improved Markdown parsing

Finally, we’ve switched from Parsedown to League’s CommonMark for Markdown parsing, and so far it’s really nice. The biggest lift here is that you can now use code blocks with language-specific syntax highlighting. Here are some examples:

Hello World in C:

int main() {
   printf("Hello World");
   return 0;
}

Method chaining in Ruby:

def longest_repetition(string)
  max = string
		  .chars
		  .chunk(&:itself)
		  .map(&:last)
		  .max_by(&:size)

  max ? [max[0], max.size] : ["", 0]
end

longest_repetition("aaabb")
# ["a", 3]

Whatever the heck this is in Javascript:

(![] + [])[+[]] +
  (![] + [])[+!+[]] +
  ([![]] + []<a href="/">]])[+!+[] + [+[</a>] +
  (![] + [])[!+[] + !+[]];
// -> 'fail'

Anyway, it’s pretty cool. This new Markdown parser will roll out to all other parts of omg.lol that use Markdown in the next few days.

Let me know if you run into any issues or have any feedback!

— Adam

Permalink