Pika Variables
You can use various special variables in your posts and pages to do things like add some recent blog posts to a custom home page. Note: They don’t work inside inline code or code blocks. Here’s what Pika supports:
Output your blog posts
There are three variables to output your blog posts:
- {{ posts }} and {{ posts_by_year }} output your posts in a list layout.
- {{ posts_in_stream }} outputs your posts in a stream layout.
They can all be customized by a number of parameters, like this example:
{{ posts limit: 10 skip: 5 tag: "Bill Murray" without_tag: "Chevy Chase" has_title: yes sent_as_newsletter: no sort: alpha }}
Parameters
limit- Maximum number of posts to display (defaults to 500 if not specified).
skip- Skip the first n posts.
tag- Only include posts with the specified tag.
without_tag- Exclude posts with the specified tag.
has_titleyes(only posts with titles) orno(only posts without titles).sent_as_newsletteryes(only posts sent as newsletters) orno(only posts not sent as newsletters).sort- Use
alphato override the default sorting by date. This parameter only works with the {{ posts }} variable. with_excerpts- Use
noto override the default, which isyes(showing excerpts with “Continue reading” links). This parameter only works with the {{ posts_in_stream }} variable.
Output your blog tags
There are two variables to output your blog post tags:
- {{ tags }} outputs an alphabetical, comma-separated list of your blog tags.
- {{ tag_list }} outputs an alphabetical HTML list of your blog tags.
Parameters
separator- Use a custom tag separator in place of a comma in the {{ tags }} variable. Example: {{ tags separator: " | " }}.
Output your Letterbird contact form
Letterbird is another service from Good Enough that allows you to create a simple contact form. While it has its own embed code, Pika has a first-class variable for you to embed your form (like on a contact page):
{{ letterbird_form user: yourusername }}
Parameters
user- Your Letterbird username. This is a required parameter.
showheader- Include your Letterbird form header.
Output your Newsletter subscribe form
While there’s an option in Newsletter Settings to automatically include your subscription form on your site, you can also embed your form anywhere with this variable:
{{ newsletter_subscription_form }}
There are no parameters for this variable.