Microhooks
Microhooks allows users to add (or modify) elements without having to over-write critical parts of Bayou Theme.
How it Works
Bayou Theme checks to see if you’ve enabled any microhooks. If you have, it’ll pull in any that you’ve added and incorporate it into the theme automatically. Since these microhooks are exclusive to your custom theme and are not supplied by Bayou, you aren’t over-writing a single file. When Bayou is updated, you’ll be able to seamlessly update without losing your changes.
Laying the Groundwork
You’ll need to create a Custom Theme in the Micro.blog dashboard (go to Design page) and activate it. At this point, nothing will have changed on your theme, you’ve just laid the ground work for your modifications.
See the first section entitled Getting Started with Themes on this post if you need help creating the custom theme.
Enabling Specific Microhooks
You’ll need to edit your newly created custom theme. Here’s where the magic happens. You’ll create a new template in that theme with the name of the appropriate path and microhook.
Examples:
layouts/partials/microhook-head.html
layouts/partials/microhook-intro.html
The layouts/partials/ portion is REQUIRED for all microhooks.
By doing that you’ve activated that particular microhook. Now, whatever you add to that new template will be reflected in your theme. You must add a new template for each microhook. This keeps things organized and easily reviewable. An incorrectly used microhook may temporarily break your site, BUT every change you make is easily reversible and NOT destructive.
Available Microhooks
microhook-head.html
This hook enables you to add anything between the <head></head>
tags of your document. For example, certain scripts and meta tags might go here.
microhook-profile-photo.html
Whatever you add to this microhook will be wrapped in <a></a>
tags that link to your home page. Most likely, you should use a simple <img src="link-to-image" class="profile_photo u-photo" width="80" height="80" alt="logo>
structure.
microhook-intro.html
The home page of Bayou theme allows you to add content between the single micropost and the list of longform posts. This microhook is how you do that. Using html
, add any content you’d like to this microhook and it’ll display on your home page. For an example, you can view the Bayou Theme home page.