"/assets/images/2021/04/CasperishTheme.png", "title"=>"Casperish Theme Description", "caption"=>"I learned a lot from reading the source of the Casperish theme for Publish."}">

Wrestling With Publish

17 Apr 2021

I've been working on converting this site from Jekyll to Publish, and here's a few cool sites I've found so far.

There’s a saying in web dev: when you hit a wall, start or redesign a site.

While I like Jekyll, I’ve found that, because I no longer spend my days in TextMate, I don’t think about my website frequently. It’s a habit thing.

So I’ve been looking into Publish (given that I live in Xcode), and there’s really very little information about how to build your own site theme if it needs anything more than the most basic of website function.

Also, while Markdown is fantastic for laying out prose within a document, it doesn’t represent the semantic parts of a page newly available in HTML5 (e.g., article, figure, figcaption, header, footer, nav, section) that help accessibility as well as search engines. Granted, Publish does have at least most of those, but you’d have to create code to inject them into your page.

Themes

Publish developer John Sundell suggested that everyone write their own theme for their site. While, yes, that is ideal (with limitations), having at least one medium complex good example can really help speed up a first implementation.

Here are the ones that were most useful, with commentary.

Others:

So…1 out of 17 had tests.

Why No, I haven’t Said Enough On That Topic

Seriously, John Sundell’s done an excellent job of making tests easy to understand and write.

Here’s one of the stylesheet tests:

func testCSSStylesheet() {
    let html = HTML(.head(.stylesheet("styles.css")))
    assertEqualHTMLContent(html, """
    <head><link rel="stylesheet" href="styles.css" type="text/css"/></head>
    """)
}

It will help you when you (almost inevitably) want to refactor later.

Did I Leave You Out?

I have looked at a ton of Publish sites over the last couple of weeks, enough so that my eyes melted more than once. ;)

Generally, I was looking for something specific, so if I didn’t see it, I may not have kept that tab open long enough to get around to writing this post. Also, I only looked on Github, so those hosting their themes on Gitlab or other platforms were left out.

Please feel free to ping me if you’ve got a site that you think shows some interesting use of Publish, especially if it has tests. I’m mostly interested in one of two kinds of sites:

  1. Sites that have more complex markup, e.g., a port of a commercial-quality theme like those found at HTML5Up.net. (I’m currently working on Solid State, thus wanted to find more examples on that order of complexity.)
  2. Sites that are using plugins or unusual publishing pipelines. However, apart from the single example above, sites that use JS steps need not apply.