Skip to content

bmarwell/jbake-blog-template-author

Repository files navigation

JBake Blog Setup with Author Theme

This repository contains the brilliant Author theme from Ben Sibley, originally written for WordPress.

Features

Author theme

The Author theme was ported by me, including a rewrite of the JavaScript files to not use jQuery.

No jQuery

Yes, I got rid of all jQuery. Really.

Multi-Language-Support

While the blog roll (index) will show all languages, the posts itselves can contain a language idicator and a link to the translations. Metadata will be added where appropriate.

Minification

The new behaviour since 2023-05-11 is: Images will not be optimized on build. Instead, run ./mvnw com.github.eirslett:frontend-maven-plugin:yarn@optimize-images to optimize all images in the src/site folder.

The old behaviour was: When building with Apache Maven, all local CSS, JS, images(!) and HTML files will be minified. You can skip the HTML and image minifcation step by using ./mvnw package -Dsite.postprocess.skip=true.

Featured Images

You can include a featured image and even select the display type for twitter and linkedin!

Simple Light Box

All your images will be opened in a mobile friendly lightbox when clicking them.

Open Graph Metadata

Metadata for Twitter, Facebook etc. will automatically be inserted when available. Fallback options are available, too.

JSON-LD support

Have crawlers read your data in a JSON format for linked data, based on schema.org.

WP-Appbox port

You can insert links to the following stores via macro (incomplete):

  • Google Play Store

  • More to come

Shariff sharing buttons

These sharing buttons do not compromise your security: No I-Frames or other injected code from the servers.

YAML-based menu

The menu can be defined using YAML. No writing of complicated HTML anymore.

Tag page descriptions

You can define descriptions for your tag page for better SEO visibility.

Setup instructions

  1. Go through the jbake.properties file and edit everything you need. Some options can be disabled entirely, some cannot. Most options should have comments by now.

  2. Go through the files in src/site/data.

    • src/site/data/authors.yaml: Define at lease one author, this is mandatory. Spelling matters, you must use the exact spelling everywhere.

    • src/site/data/keywords.yaml: Keywords are optional. You can add descriptions for the tags pages here. If not defined here, the tag page will just be missing the description.

    • src/site/data/license.yaml:: Edit the license according to your need. This will be applied to all CONTENT YOU WRITE, not to any of this repository.

    • src/site/data/socialmedia.yaml: You can define which buttons to show below your avatar.

Writing Posts and Pages

This section will only cover the AsciiDoc format.

AsciiDoc examples

The following snippet is a sample header for your asciidoc posts:

// This work is licensed under a
// <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.

= Site title
:jbake-author: Author name as spelled in authors.yaml
:jbake-date: 2017-03-09 20:16:13
:jbake-updated: 2017-03-09 20:16:13
:jbake-lang: de-DE
:jbake-type: post
:jbake-status: published
:jbake-tags: open source, software, example, post, asciidoc, jbake
:jbake-featuredimage: my-featured-image.png
:jbake-featuredimagewidth: 2000
:jbake-featuredimageheight: 2000
:jbake-twittercard: large
// :jbake-alternate: { "en-GB": "" }
:toc: macro
:idprefix:
:icons: font
  • The license is optional and specific for this content, but should in general be the same as defined in the license.yaml file.

  • Dates MUST be written in the ISO format, timezone UTC.

  • lang can be set to a two-letter ISO code (de, en) or can contain a region, separated by a hyphen.

  • Tags are a comma separated list of keywords. A keyword index will be created, as well as a page for each keyword.

  • If no featured image is present, the default featured image from jbake.properties will be used.

  • toc, idprefix and icons are optional. Remove or adjust to your liking.

Adding twitter widgets

This template supports adding timelines and tweets.

One option is to include a timeline. At the moment, there is no freemarker macro, but an HTML passthrough will do.

Be sure to add the classes "twitter" and "timeline". The data-twitter-timeline-id is the actual source for the generated timeline. As a fallback, you can insert or link the referenced timeline.

Adding a user timeline
++++
<div class="twitter timeline wp-block" data-twitter-timeline-id="bmarwell"><a href="https://twitter.com/bmarwell">https://twitter.com/bmarwell</a></div>
++++

You can also link a specific tweet. Instead of the timeline class, use the tweet class. Again, you can optionally add some fallback content.

Adding a specific tweet
++++
<div class="twitter tweet wp-block" data-tweet-id="1508528412679356416">
 https://twitter.com/bmarwell/status/1508528412679356416
</div>
++++

WP Appbox

This is supported via HTML only, most data needs to be inserted by hand. A freemarker macro is in the making.

Simple Lightbox

All images should open in a simple lightbox on click.

Custom robots.txt

Delete the file /src/site/content/robots.adoc and create a file /src/site/assets/robots.txt instead.

Publishing

Compile your web site using ./mvnw package.

If you want a live preview, use ./mvnw generate-resources jbake:inline.

Roadmap

  • Appbox support

  • Better sitemap support.

  • Touch icon support

  • Fix a lot of HTML errors, e.g.

    • span with href

    • img without alt

    • img resolution attributes with "px" suffix

    • unencoded paths in href attributes to tags

  • Identify index sites and add metadata (e.g. lang attribute).