Latest version 2.0
Released 1 year ago
This theme provides a simple way to turn posts into Wikipedia-style category banners or notices at the top of entities. The plugin takes care of the ground work without any styling except for centering the text, and you can use tags and additional campaign CSS to preset your own varied banner templates. Inspired by Ornstein’s Stub Banner plugin.
Note that you can post multiple notices on the same entity. Just repeat steps 1 to 3 for each notice and order them as desired.
The plugin is set up to allow you to use Kanka’s default color classes alongside notice-post to quickly set the background and text color, for example notice-post bg-olive in the first screenshot below. You can find the current list of available classes on Github here and here.
You can also design your own classes to reuse as needed in your campaign’s theming, for example notice-2-cols for 2-column notices or notice-huge for a notice with very noticeable text. This way, you can focus on just writing the text of your notices in your posts and simply add an extra class to take care of frequently used styling.
Since you will likely use the exact same message in several entities, it would be bothersome to copy-paste the same content every time. What I like to do is make use of transclusion to create templates as Tag entities and simply refer to those via advanced mentions. This way, if I ever want to change the wording of a notice across the entire campaign, I only need to edit one entity.
Repeat as needed. Then, when adding notices to entities, use an advanced mention to this entity instead of repeating the content:
field:entry
parameter, so it looks like this: [tag:2882042|field:entry]
.field:entry
parameter, so it looks like this: [tag:2882042|field:entry]
.This will transclude your template entity’s entry into the post and keep it up to date at all times. You still need to specify the notice-post class on each individual post, as well as any custom classes you may have created and rely upon.
The first screenshot is a very lazy example that uses a table to display an icon on the left and a bit of text on the right. The colors are controlled by adding the bg-olive class to the post alongside notice-post.
<table> <tbody> <tr> <td style="font-size:20px;padding:0 10px 0 0;">🌟</td> <td>This article was voted <strong>*most awesome*</strong> for the month of <strong>February 2023</strong>.</td> </tr> </tbody> </table>
The second screenshot uses a custom adventure-banner class to set up a standard structure that can be reused for various categories of content, each of which defines its own specific background image with a dedicated class like saltmarsh.
/* Foundation for adventure banner backgrounds */ .notice-post.adventure-banner { background: transparent; border-radius: 3px; } /* Prepare a pseudo-element for the bg image so effects can be applied to it without affecting post content */ .notice-post.adventure-banner::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; } /* Set up a grid and position elements over the background */ .notice-post.adventure-banner { display: grid; grid-template-columns: 15px auto 15px; grid-template-areas: "left mid right"; min-height: 60px; } .notice-post.adventure-banner .post-header { grid-area: right; } .notice-post.adventure-banner .bg-box { grid-area: mid; z-index: 1; align-self: center; } /* Keep action dropdown visible on dark bg */ .notice-post .post-header .dropdown > a { color: white; } /* Common styles for main text */ .notice-post.adventure-banner p { color: white; font-size: 20px; font-family: "Crimson Pro", "Georgia", serif; font-style: italic; text-shadow: black 1px 2px 3px; } .notice-post.adventure-banner p strong { font-size: 22px; white-space: nowrap; /* optional, to prevent line breaks in important terms */ } /* Style specific adventure banners */ .notice-post.saltmarsh::before { background-image: url("your-image-source.webp"); background-size: 100%; background-position-y: 85%; filter: brightness(1.1) blur(0.5px); }
Want to show appreciation for my plugins or request one-on-one CSS help? I accept tips on Ko-fi (no account needed):
Released 1 year ago