Is it possible to customize a footer template per-post?

I’m gonna put out an example of how I would do it, and you see which parts you like or have questions about.

I’d base the CTA on front matter. Then, in your templates you also have that default CTA, and conditionally show something else based on your parameters.

I don’t know what a CTA is for you. If it is just some hypertext, I’d probably just make that a line in front matter, like so:

cta: "Don't be a lozer, [join our cult today](https://example.com/phish.php?redirect=localhost)!"

If it is more complicated than that, well, maybe load conditional templates based on keywords or something.

Also…

If you really want to include the CTA via a shortcode, you can still have a separate CTA outside .Content, and then check for shortcode use. If your CTA shortcode is present, don’t create the default CTA, and so forth.

I personally don’t recommend that, unless you ensure your default CTA is included wherever your content is rendered, such as RSS feeds, otherwise your content has inconsistent CTAs sprinkled through them… ugh, that would keep me up at night! :slight_smile:

1 Like