<?xml version="1.0" encoding="utf-8"?>



<feed xmlns="http://www.w3.org/2005/Atom"
    xmlns:fh="http://purl.org/syndication/history/1.0"
    xmlns:at="http://purl.org/atompub/tombstones/1.0">

    <title>Publ: Template API</title>
    <subtitle>A personal publishing system for the modern web</subtitle>
    <link href="https://publ.beesbuzz.biz/manual/api/feed" rel="self" />
    <link href="https://publ.beesbuzz.biz/manual/api/feed" rel="current" />
    <link href="https://busybee.superfeedr.com" rel="hub" />
    
    
    <link href="https://publ.beesbuzz.biz/manual/api/" />
    
    <id>tag:publ.beesbuzz.biz,2020-01-07:manual/api</id>
    <updated>2020-08-01T23:51:44-07:00</updated>

    
    <entry>
        <title>User object</title>
        <link href="https://publ.beesbuzz.biz/manual/api/733-User-object" rel="alternate" type="text/html" />
        <published>2020-08-01T23:51:44-07:00</published>
        <updated>2020-08-01T23:51:44-07:00</updated>
        <id>urn:uuid:a16621e8-31a5-5f50-82eb-2f52bdd5330d</id>
        <author><name>fluffy</name></author>
        <content type="html">
<![CDATA[
<p>Template API for the <code>user</code> object</p>

<p>The <code>user</code> object provides the following:</p>
<ul>
<li><strong><code>identity</code></strong>: The identity URL of the user</li>
<li><p><strong><code>humanize</code></strong>: A humanized version of the identity URL</p></li>
<li><p><strong><code>name</code></strong>: The display name of the user</p></li>
<li><p><strong><code>profile</code></strong>: The user profile; see the <a href="https://authl.readthedocs.io/en/latest/authl.html#authl.disposition.Verified">Authl documentation</a> for the relevant keys.</p><p>Note that this will not necessarily be available, depending on how and when the user logged in. For example, if the database has been fully reset (due to e.g. a Publ upgrade or a server migration) since they last logged in, or if the user logged in from a different instance on a load-balanced configuration using a per-instance database, the profile will likely not be present.</p></li>
<li><p><strong><code>groups</code></strong>: A list of the groups they belong to (not including the user&rsquo;s identity group)</p></li>
<li><p><strong><code>auth_groups</code></strong>: The full list of matching authentication groups (including the user&rsquo;s own identity group)</p></li>
<li><p><strong><code>is_admin</code></strong>: <code>True</code> if the user is a member of the administrative group</p></li>
<li><p><strong><code>auth_type</code></strong>: How the user&rsquo;s authentication was obtained; possible values:</p>
<ul>
<li><code>&#39;session&#39;</code>: Normal login flow/session cookie</li>
<li><code>&#39;token&#39;</code>: Bearer token</li>
</ul></li>
<li><p><strong><code>scope</code></strong>: The user&rsquo;s permission scopes, if applicable (typically if the login was via a bearer token)</p></li>
<li><p><strong><code>last_login</code></strong>: The last time the user logged in</p><p>This may not be available, per the same rules as <code>user.profile</code></p></li>
<li><p><strong><code>last_seen</code></strong>: The last time the user was active on the site</p></li>
<li><p><span id="is_bot"><strong><code>is_bot</code></strong></span>: Whether the page is currently being viewed by a declared bot</p></li>
<li><p><span id="token"><strong><code>token(lifetime,scope=None)</code></strong></span>: A function to generate an HTTP Bearer token for preauthorization.</p><p>Arguments:</p>
<ul>
<li><code>lifetime</code>: How long the token is good for, in seconds</li>
<li><code>scope</code>: The access scopes that should be associated with the token</li>
</ul>
<p>See <a href="https://publ.beesbuzz.biz/manual/238-Command-Line-Interface#token">using bearer tokens</a> for more information.</p></li>
</ul>
<p>For the most part you should only use <code>user.name</code> to address the user, and possibly use <code>user.groups</code> to check for particular group membership if that is something you want to show them. For example, if you use user groups as a means of managing memberships or rewards or the like, you could do something like:</p><figure class="blockcode"><pre class="highlight" data-language="jinja" data-line-numbers><span class="line" id="e733cb1L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L1"></a><span class="line-content"><span class="x">Hello, </span><span class="cp">{{</span><span class="nv">user.name</span><span class="cp">}}</span><span class="x">.</span></span></span>
<span class="line" id="e733cb1L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="s1">&#39;current_members&#39;</span> <span class="k">in</span> <span class="nv">user.groups</span> <span class="cp">%}</span></span></span>
<span class="line" id="e733cb1L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L3"></a><span class="line-content"><span class="x">    Your membership is current!</span></span></span>
<span class="line" id="e733cb1L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span></span></span>
<span class="line" id="e733cb1L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L5"></a><span class="line-content"><span class="x">    You aren&#39;t currently a member. Please consider &lt;a href=&quot;/subscribe&quot;&gt;becoming one&lt;/a&gt;.</span></span></span>
<span class="line" id="e733cb1L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb1L6"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
</pre></figure><p>When extending Publ using additional Python functions, the current user can be retrieved with:</p><figure class="blockcode"><pre class="highlight" data-language="python" data-line-numbers><span class="line" id="e733cb2L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb2L1"></a><span class="line-content"><span class="kn">import</span><span class="w"> </span><span class="nn">publ.user</span></span></span>
<span class="line" id="e733cb2L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb2L2"></a><span class="line-content"><span class="n">user</span> <span class="o">=</span> <span class="n">publ</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">get_active</span><span class="p">()</span></span></span>
</pre></figure><p>In all contexts you can check the truthiness of the <code>user</code> object to see if someone is logged in; bots do not count as logged-in users. For example, in a template:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e733cb3L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">user</span> <span class="cp">%}</span></span></span>
<span class="line" id="e733cb3L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L2"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Hello user <span class="cp">{{</span><span class="nv">user.name</span><span class="cp">}}</span>!<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span></span></span>
<span class="line" id="e733cb3L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L3"></a><span class="line-content"><span class="cp">{%</span> <span class="k">elif</span> <span class="nv">user.is_bot</span> <span class="cp">%}</span></span></span>
<span class="line" id="e733cb3L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L4"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Hello bot <span class="cp">{{</span><span class="nv">user.name</span><span class="cp">}}</span>!<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span></span></span>
<span class="line" id="e733cb3L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L5"></a><span class="line-content"><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span></span></span>
<span class="line" id="e733cb3L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L6"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">P</span><span class="p">&gt;</span>Howdy, stranger!<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span></span></span>
<span class="line" id="e733cb3L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/733-User-object#e733cb3L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
</pre></figure>

]]>
        </content>
    </entry>
    
    <entry>
        <title>Template object</title>
        <link href="https://publ.beesbuzz.biz/manual/api/416-Template-object" rel="alternate" type="text/html" />
        <published>2018-04-25T15:15:40-07:00</published>
        <updated>2018-04-25T15:15:40-07:00</updated>
        <id>urn:uuid:26798d78-9d88-4fd5-95cd-f03baca12aff</id>
        <author><name>fluffy</name></author>
        <content type="html">
<![CDATA[
<p>Template API for the <code>template</code> object</p>

<p>The <code>template</code> object provides the following:</p>
<ul>
<li><strong><code>name</code></strong>: The name of the template</li>
<li><strong><code>filename</code></strong>: The underlying filename of the template</li>
<li><strong><code>last_modified</code></strong>: When the file was most recently modified</li>
<li><span id="func-image"><strong><code>image</code></strong></span>: Resolves an image relative to this template&rsquo;s context, by path. This is a context-specific version of the <a href="https://publ.beesbuzz.biz/manual/324-Templating-Guide#func-image">global <code>image</code> function</a>.</li>
</ul>


]]>
        </content>
    </entry>
    
    <entry>
        <title>View object</title>
        <link href="https://publ.beesbuzz.biz/manual/api/150-View-object" rel="alternate" type="text/html" />
        <published>2018-04-25T15:03:55-07:00</published>
        <updated>2018-04-25T15:03:55-07:00</updated>
        <id>urn:uuid:d506b63c-dd77-4c7a-b06e-c381696c3cc2</id>
        <author><name>fluffy</name></author>
        <content type="html">
<![CDATA[
<p>The template API for view objects.</p>

<p>The <code>view</code> object has the following things on it:</p>
<ul>
<li><p><span id="entries"><strong><code>entries</code></strong></span>: A list of all of the entries that are visible and authorized in this view</p><p>Optionally takes a parameter, <code>unauthorized</code>, which indicates the maximum number of unauthorized entries which will be included. If this is a number, that number of unauthorized entries will be included; if True, <em>all</em> unauthorized entries will be included. These entries will count against the <code>count</code> limit, if any. Defaults to <code>0</code>.</p><p>Iterating on the <code>view</code> itself is equivalent to iterating on its <code>entries</code> without any arguments.</p></li>
<li><p><strong><code>deleted</code></strong>: A list of all of the entries that were deleted from this view (with <code>Status: GONE</code> or <code>Status: DELETED</code>)</p></li>
<li><p><span id="unauthorized"><strong><code>unauthorized</code></strong></span>: A list of entries which would be included if the user were authorized.</p><p>This is mostly so that a template can indicate whether a logged-out user should try logging in to see the protected entries, or for feeds to show placeholders.</p><p>Optionally takes a parameter, <code>count</code>, which indicates the maximum number that will be included. If not specified it will use the <code>count</code> limit, if any.</p><p>Note that visible, authorized entries <em>do not</em> count against the limit.</p></li>
<li><p><span id="has_unauthorized"><strong><code>has_unauthorized</code></strong></span>: Indicates whether the view has any entries which could become visible if a different user were logged in.</p></li>
<li><p><strong><code>count</code></strong>: The number of visible entries in the view</p></li>
<li><p><strong><code>last_modified</code></strong>: A last-modified time for this view (useful for feeds)</p></li>
<li><p><strong><code>spec</code></strong>: The view&rsquo;s specification (category, count, date, etc.)</p><p>This is in the form of the arguments that would be passed to <code>get_view</code> to
obtain this view. For example, you can use <code>&#39;date&#39; in view.spec</code> to determine
whether a view is date-based.</p></li>
<li><p><strong><code>previous</code></strong>: The previous page for this view, based on the current sort order</p></li>
<li><p><strong><code>next</code></strong>: The next page for this view, based on the current sort order</p></li>
<li><p><strong><code>older</code></strong>: The previous page for this view, going back in time</p></li>
<li><p><strong><code>newer</code></strong>: The next page for this view, going forward in time</p></li>
<li><p><strong><code>current</code></strong>: The current/default page of this view; can take additional <a href="https://publ.beesbuzz.biz/manual/api/feed#subviews">restriction parameters</a></p></li>
<li><p><strong><code>is_current</code></strong>: Whether this view is the current/default page</p></li>
<li><p><strong><code>paging</code></strong>: Returns the type of pagination that is in effect for this view; one of:</p>
<ul>
<li><strong><code>offset</code></strong>: Based on entry offset</li>
<li><strong><code>year</code></strong>: Based on the entry&rsquo;s publication year</li>
<li><strong><code>month</code></strong>: Based on the entry&rsquo;s publication month</li>
<li><strong><code>day</code></strong>: Based on the entry&rsquo;s publication day</li>
</ul>
<p>These values are the same as the <code>paging</code> parameter of <a href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#archive.paging"><code>entry.archive</code></a>.</p></li>
<li><p><span id="all_pages"><strong><code>pages</code></strong>: A list of every page for this view based on the current pagination.</span></p><p><mark>Note:</mark> This will probably be <em>very slow</em>; use sparingly.</p></li>
<li><p><strong><code>link</code></strong>: The link to this view; optionally takes the following arguments:</p>
<ul>
<li><strong><code>category</code></strong>: Which category to use (defaults to the category this view is queried against)</li>
<li><strong><code>template</code></strong>: Which template to use (defaults to the index template)</li>
<li><strong><code>absolute</code></strong>: Whether the URL should be absolute or relative

<ul>
<li><strong><code>False</code></strong>: Use a relative URL (default)</li>
<li><strong><code>True</code></strong>: Use an absolute URL</li>
</ul></li>
</ul></li>
<li><p><strong><code>first</code></strong>: The first entry in the view</p></li>
<li><p><strong><code>last</code></strong>: The last entry in the view</p></li>
<li><p><strong><code>newest</code></strong>: The newest entry in the view</p></li>
<li><p><strong><code>oldest</code></strong>: The oldest entry in the view</p></li>
<li><p><strong><code>range</code></strong>: A textual description of the range of entries on this view, if the
view has any sort of pagination-type constraints. Takes the following optional arguments:</p>
<ul>
<li><strong><code>day</code></strong>: The format to use for daily pagination, or a time period within a month; defaults to <code>YYYY/MM/DD</code></li>
<li><strong><code>week</code></strong>: The format to use for a weekly pagination; defaults to <code>YYYY/MM/DD</code></li>
<li><strong><code>month</code></strong>: The format to use for a monthly pagination, or a time period covering multiple months; defaults to <code>YYYY/MM</code></li>
<li><strong><code>year</code></strong>: The format to use for a yearly pagination, or a tim eperiod covering multiple years; defaults to <code>YYYY/MM</code></li>
<li><strong><code>span</code></strong>: The format to use for a range of entries where the first and last entry dates differ (after formatting);
defaults to <code>{oldest} — {newest} ({count})</code></li>
<li><strong><code>single</code></strong>: The format to use for a range of entries where the first and last are within the same time period;
defaults to <code>{oldest} ({count})</code></li>
</ul>
<p>If there is only a single entry in the view, the <code>range</code> property will be formatted
for its time period directly, and it only uses the <code>day</code>, <code>month</code>, or <code>year</code> format.</p><p>If there are multiple entries, then the time period is chosen with the following logic:</p>
<ul>
<li>If they are within the same month, it uses <code>day</code></li>
<li>If they are within the same year (but on different months), it uses <code>month</code></li>
<li>Otherwise, it uses <code>year</code></li>
</ul>
<p>Both dates are formatted based on the format corresponding to the chosen
period. If they are the same, the <code>single</code> format is used; otherwise the
<code>span</code> format is used. Both of these formats receive the following template
values:</p>
<ul>
<li><strong><code>oldest</code></strong>: The formatted date of the earliest entry</li>
<li><strong><code>newest</code></strong>: The formatted date of the latest entry</li>
<li><strong><code>count</code></strong>: The number of entries in the view</li>
</ul>
<p>The specified formats for <code>day</code> <code>month</code> and <code>year</code> can be as specific as you
would like; for example, if you want to always show the months in question
regardless of the span, you can set all three formats to <code>YYYY-MM</code>, or on
the other end of the spectrum you could indicate the full format down to the
nanosecond if you really want to for some reason.</p><p>Any format string accepted by <a href="http://arrow.readthedocs.io/en/latest/#tokens">Arrow</a>
is acceptable (for example, <code>MMMM YYYY</code> will appear as <code>January 2012</code>).</p></li>
<li><p><span id="tags"><strong><code>tags</code></strong>: Any tags that are applied to this view, provided as a (possibly-empty) list.</span></p></li>
<li><p><strong><code>tag_add</code></strong>: Generates a view with one or more tags added</p></li>
<li><p><strong><code>tag_remove</code></strong>: Generates a view with one or more tags removed</p></li>
<li><p><strong><code>tag_toggle</code></strong>: Generates a view with one or more tags toggled</p><p>This is useful for a tag browser where you want to be able to toggle tags on and off; for example:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e150cb1L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb1L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e150cb1L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb1L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">name</span><span class="o">,</span><span class="nv">count</span> <span class="k">in</span> <span class="nv">category.tags</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb1L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb1L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">view.tag_toggle</span><span class="o">(</span><span class="nv">name</span><span class="o">)</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> (<span class="cp">{{</span><span class="nv">count</span><span class="cp">}}</span> entries)<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e150cb1L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb1L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb1L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb1L5"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure></li>
</ul>
<h3 id="150_h3_1_Getting-subviews"><a href="https://publ.beesbuzz.biz/manual/api/150-View-object#150_h3_1_Getting-subviews"></a><span id="subviews">Getting subviews</span></h3><p>Any view object can also take arguments to further refine the view; the following
arguments are supported:</p>
<ul>
<li><p><strong><code>category</code></strong>: The top-level categories to consider; can be a single category or a list of categories.</p><p>Setting this to <code>None</code> will get entries from all categories; this is equivalent to <code>category=&#39;&#39;,recurse=True</code></p></li>
<li><p><strong><code>category_not</code></strong>: Categories to exclude; this can be either a single category, or a list of categories.</p></li>
<li><p><strong><code>recurse</code></strong>: Whether to include subcategories.</p>
<ul>
<li><code>True</code>: Include subcategories</li>
<li><code>False</code>: Do not include subcategories (default)</li>
</ul></li>
<li><p><strong><code>future</code></strong>: Whether to include entries from the future.</p>
<ul>
<li><code>True</code>: Include future entries</li>
<li><code>False</code>: Do not include future entries (default)</li>
</ul></li>
<li><p><strong><code>date</code></strong>: Limit to entries based on a specified date; this can be of the format <code>YYYY</code>, <code>YYYY-MM</code>, or <code>YYYY-MM-DD</code>.</p></li>
<li><p><strong><code>count</code></strong>: Limit to a maximum number of entries.</p><p>If <code>date</code> is set, <code>count</code> has no effect.</p></li>
<li><p><strong><code>entry_type</code></strong>: Limit to entries with a specific <a href="https://publ.beesbuzz.biz/entry-format#entry-type"><code>Entry-Type</code></a> header</p></li>
<li><p><strong><code>entry_type_not</code></strong>: Limit to entries which do NOT match a specific entry type</p><p>These can be a single string, or it can be an array of strings. Note that
these are case-sensitive (i.e. <code>&quot;PaGe&quot;</code> and <code>&quot;pAgE&quot;</code> are two different types).</p>
<ul>
<li><code>get_view(entry_type=&#39;page&#39;)</code>: only get entries of type &ldquo;page&rdquo;</li>
<li><code>get_view(entry_type_not=&#39;page&#39;)</code>: only get entries which AREN&rsquo;T of type &ldquo;page&rdquo;</li>
<li><code>get_view(entry_type=[&#39;news&#39;,&#39;comic&#39;])</code>: get entries which are of type &lsquo;news&rsquo; or &lsquo;comic&rsquo;</li>
<li><code>get_view(entry_type_not=[&#39;news&#39;,&#39;comic&#39;])</code>: get entries of all types except &lsquo;news&rsquo; or &lsquo;comic&rsquo;</li>
</ul>
<p>Mixing <code>entry_type</code> and <code>entry_type_not</code> results in undefined behavior, not that it makes
any sense to do that anyway.</p></li>
<li><p><strong><code>tag</code></strong>: Limit the view to entries which match the listed tag(s).</p></li>
<li><p><span id="tag_filter"><strong><code>tag_filter</code></strong></span>: What filter criterion to use for matching tags. One of:</p>
<ul>
<li><strong><code>&#39;ANY&#39;</code></strong>: All entries which have at least one of the listed tags (default); this can also be spelled <code>&#39;OR&#39;</code></li>
<li><strong><code>&#39;ALL&#39;</code></strong>: Entries which have all of the listed tags; this can also be spelled <code>&#39;AND&#39;</code></li>
<li><strong><code>&#39;NONE&#39;</code></strong>: Entries which have none of the listed tags&#39;; this can also be spelled <code>&#39;NOT&#39;</code></li>
</ul></li>
<li><p><strong><code>start</code></strong>: Limit the view to start with this entry, regardless of sort order</p></li>
<li><p><strong><code>last</code></strong>: Limit the view such to none newer than the specified entry (by id or object)</p></li>
<li><p><strong><code>first</code></strong>: Limit the view such to none older than the specified entry</p></li>
<li><p><strong><code>before</code></strong>: Limit the view to only entries which came before the specified entry</p></li>
<li><p><strong><code>after</code></strong>: Limit the view to only entries which came after the specified entry</p></li>
<li><p><span id="order"><strong><code>order</code></strong></span>: What sort order to provide the entries in; one of:</p>
<ul>
<li><strong><code>oldest</code></strong>: Oldest-first</li>
<li><strong><code>newest</code></strong>: Newest-first (default)</li>
<li><strong><code>title</code></strong>: Sorted alphabetically by title</li>
</ul></li>
<li><p><span id="attachments"><strong><code>has_attachments</code></strong></span>: Limit the view to entries with (if <code>True</code>) or without (if <code>False</code>) attachments</p></li>
<li><p><strong><code>is_attached</code></strong>: Limit the view to entries which are (if <code>True</code>) or are not (if <code>False</code>) attachments</p></li>
<li><p><strong><code>attachments</code></strong>: Limit the view to entries which are attachments of the specified entry</p></li>
<li><p><strong><code>attached</code></strong>: Limit the view to entries which have the specified entry attached</p></li>
</ul>
<p>For example, this will print the titles of
the first 10 entries in the view, including subcategories:</p><figure class="blockcode"><pre class="highlight" data-language="jinja" data-line-numbers><span class="line" id="e150cb2L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb2L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">entry</span> <span class="k">in</span> <span class="nv">view</span><span class="o">(</span><span class="nv">count</span><span class="o">=</span><span class="m">10</span><span class="o">,</span><span class="nv">recurse</span><span class="o">=</span><span class="kp">True</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb2L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb2L2"></a><span class="line-content"><span class="x">    </span><span class="cp">{{</span><span class="nv">entry.title</span><span class="cp">}}</span></span></span>
<span class="line" id="e150cb2L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb2L3"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
</pre></figure><p>If you want to use the same view refinement multiple times, you can use <code>{% set %}</code>:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e150cb3L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">content</span> <span class="o">=</span> <span class="nv">view</span><span class="o">(</span><span class="nv">count</span><span class="o">=</span><span class="m">10</span><span class="o">,</span><span class="nv">recurse</span><span class="o">=</span><span class="kp">True</span><span class="o">,</span><span class="nv">entry_type_not</span><span class="o">=</span><span class="s1">&#39;sidebar&#39;</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb3L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">content.entries</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb3L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e150cb3L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">entry</span> <span class="k">in</span> <span class="nv">content.entries</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb3L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L5"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">entry.title</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e150cb3L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L6"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e150cb3L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L7"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e150cb3L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/150-View-object#e150cb3L8"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
</pre></figure><h4 id="150_h4_2_view-...-vs-get_view"><a href="https://publ.beesbuzz.biz/manual/api/150-View-object#150_h4_2_view-...-vs-get_view"></a><span id="get_view"></span> <code>view(...)</code> vs <code>get_view(...)</code></h4><p>The global <code>get_view()</code> function creates an entirely new view from scratch, rather
than basing it on the current default view. Some possible uses for this are:</p>
<ul>
<li>Getting a link to the latest entry on the entire site (e.g. <code>get_view().newest</code>)</li>
<li><p>Properly showing the current category&rsquo;s sidebar links without filtering them by date or page (e.g. <code>get_view(category=category,entry_type=&#39;sidebar&#39;)</code>)</p><p>Note that this can also be achieved with <code>view.current(entry_type=&#39;sidebar&#39;)</code></p></li>
<li><p>Having a global set of sidebar links (e.g. <code>get_view(entry_type=&#39;sidebar&#39;)</code>)</p></li>
</ul>


]]>
        </content>
    </entry>
    
    <entry>
        <title>Category objects</title>
        <link href="https://publ.beesbuzz.biz/manual/api/170-Category-objects" rel="alternate" type="text/html" />
        <published>2018-04-25T15:02:41-07:00</published>
        <updated>2018-04-25T15:02:41-07:00</updated>
        <id>urn:uuid:81cbd7d2-55c5-48d5-b27c-29b8b6d8a3b0</id>
        <author><name>fluffy</name></author>
        <content type="html">
<![CDATA[
<p>Template API for categories.</p>

<p>The <code>category</code> object provides the following:</p>
<ul>
<li><p><strong><code>path</code></strong>: The full path to the category</p></li>
<li><p><strong><code>basename</code></strong>: Just the last part of the category path</p></li>
<li><p><strong><code>name</code></strong>: A display name for the category.</p><p>This defaults to taking the category basename, converting <code>_</code>s to spaces, and then
title-casing the name. For example, the category <code>some/long/category_name</code> will have
a default name of <code>&quot;Category Name&quot;</code>. This can be overridden using a <a href="https://publ.beesbuzz.biz/manual/api/feed#meta-files">meta file</a>.</p><p>Optionally takes <a href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#html-processing">HTML processing arguments</a>.</p></li>
<li><p><strong><code>subcats</code></strong>: The subcategories of this category. Takes the following argument:</p>
<ul>
<li><p><strong><code>recurse</code></strong>: Whether to include the subcategories of the subcategories, and their subcategories
and so on. Possible values:</p>
<ul>
<li><strong><code>False</code></strong>: Only include direct subcategories (default)</li>
<li><strong><code>True</code></strong>: Include all subcategories</li>
</ul></li>
</ul></li>
<li><p><strong><code>parent</code></strong>: The parent category, if any</p></li>
<li><p><strong><code>link</code></strong>: The link to the category; optionally takes the
following arguments:</p>
<ul>
<li><strong><code>template</code></strong>: Which template to use when rendering the category</li>
<li><strong><code>absolute</code></strong>: Whether to format this as an absolute or relative URL

<ul>
<li><strong><code>False</code></strong>: Use a relative link (default)</li>
<li><strong><code>True</code></strong>: Use an absolute link</li>
</ul></li>
</ul></li>
<li><p><strong><code>first</code></strong>: Returns the first entry in this category; optionally takes <a href="https://publ.beesbuzz.biz/api#get-view">view arguments</a></p></li>
<li><p><strong><code>last</code></strong>: Returns the last entry in this category; optionally takes <a href="https://publ.beesbuzz.biz/api#get-view">view arguments</a></p><p>Note that <code>first</code> and <code>last</code> will potentially point to entries for which the user is not authorized. If that matters, use <a href="https://publ.beesbuzz.biz/manual/api/150-View-object#get_view"><code>get_view</code></a> instead.</p></li>
<li><p><strong><code>get</code></strong>: Get a header defined in the <a href="https://publ.beesbuzz.biz/manual/api/feed#meta-files">meta file</a></p></li>
<li><p><strong><code>get_all</code></strong>: Get all instances of a meta file header as a list</p></li>
<li><p><strong><code>description</code></strong>: Get the category description from the <a href="https://publ.beesbuzz.biz/manual/api/feed#meta-files">meta file</a>, if it exists. This optionally
takes the standard <a href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#html-processing">HTML processing arguments</a>.</p></li>
<li><p><strong><code>sort_name</code></strong>: The name used for sorting</p></li>
<li><p><span id="breadcrumb"><strong><code>breadcrumb</code></strong>: A list of the categories that lead to this one, as <code>category</code> objects, including the current one.</span></p></li>
<li><p><span id="root"><strong><code>root</code></strong>: The root category of the blog, useful for storing site-level metadata (such as the site name or global configuration).</span></p><p>This is roughly equivalent to <code>category.breadcrumb[0]</code>, but is slightly more efficient and easier to type.</p></li>
<li><p><span id="tags"><strong><code>tags</code></strong>: A list of tags available on the category, provided as pairs of name and count.</span></p><p>This can take optional view arguments, such as <code>recurse</code>, <code>tag</code>, and <code>tag_filter</code>.</p><p>There are multiple ways to access the tag information, depending on preference; for example, you can separate them in the loop:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb1L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb1L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb1L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb1L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">name</span><span class="o">,</span><span class="nv">count</span> <span class="k">in</span> <span class="nv">category.tags</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb1L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb1L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">view</span><span class="o">(</span><span class="nv">tag</span><span class="o">=</span><span class="nv">name</span><span class="o">)</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> (<span class="cp">{{</span><span class="nv">count</span><span class="cp">}}</span> entries)<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb1L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb1L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb1L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb1L5"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>or you can get at them directly:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb2L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb2L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb2L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb2L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span> <span class="k">in</span> <span class="nv">category.tags</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb2L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb2L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">view</span><span class="o">(</span><span class="nv">tag</span><span class="o">=</span><span class="nv">tag.name</span><span class="o">)</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> (<span class="cp">{{</span><span class="nv">tag.count</span><span class="cp">}}</span> entries)<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb2L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb2L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb2L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb2L5"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>This does not provide any built-in sorting; you can use <a href="http://jinja.pocoo.org/docs/2.10/templates/#sort">Jinja&rsquo;s <code>sort</code> filter</a> for that:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb3L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb3L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb3L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb3L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">name</span><span class="o">,</span><span class="nv">count</span> <span class="k">in</span> <span class="nv">category.tags</span><span class="o">|</span><span class="nf">sort</span><span class="o">(</span><span class="nv">attribute</span><span class="o">=</span><span class="s1">&#39;count&#39;</span><span class="o">,</span><span class="nv">reverse</span><span class="o">=</span><span class="kp">True</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb3L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb3L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">view</span><span class="o">(</span><span class="nv">tag</span><span class="o">=</span><span class="nv">name</span><span class="o">)</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> (<span class="cp">{{</span><span class="nv">count</span><span class="cp">}}</span> entries)<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb3L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb3L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb3L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb3L5"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>If you want the tags to display based on a <code>view</code> you can pass in <code>**view.spec</code> as the argument
list; for example, this snippet will override the page&rsquo;s view to require all tags to be present,
and print a refinement list of tags:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb4L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">view</span> <span class="o">=</span> <span class="nv">view</span><span class="o">(</span><span class="nv">tag_filter</span><span class="o">=</span><span class="s1">&#39;ALL&#39;</span><span class="o">)</span> <span class="cp">%}</span>  <span class="c">{# modify view to require all</span></span></span>
<span class="line" id="e170cb4L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L2"></a><span class="line-content"><span class="c">                                            selected tags to be present #}</span></span></span>
<span class="line" id="e170cb4L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L3"></a><span class="line-content"></span></span>
<span class="line" id="e170cb4L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L4"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb4L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L5"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">name</span><span class="o">,</span><span class="nv">count</span> <span class="k">in</span> <span class="nv">category.tags</span><span class="o">(**</span><span class="nv">view.spec</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb4L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L6"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">view.tag_toggle</span><span class="o">(</span><span class="nv">name</span><span class="o">)</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> (<span class="cp">{{</span><span class="nv">count</span><span class="cp">}}</span>)<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb4L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L7"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb4L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb4L8"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>}</p></li>
<li><p><span id="func-image"><strong><code>image</code></strong></span>: Resolves an image relative to this category&rsquo;s context, by path. This is a context-specific version of the <a href="https://publ.beesbuzz.biz/manual/324-Templating-Guide#func-image">global <code>image</code> function</a>.</p></li>
<li><p>The following properties are also available but probably aren&rsquo;t of use to template authors, and are only listed for the sake of completion. You should not rely on them for anything as they might change without warning.</p>
<ul>
<li><p><code>file_path</code>: The file path of the category&rsquo;s metadata file</p></li>
<li><p><code>aliases</code>: The various registered path aliases for this category</p></li>
</ul></li>
</ul>
<p>Example template code for printing out an entire directory structure (flattened):</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb5L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb5L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb5L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb5L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">subcat</span> <span class="k">in</span> <span class="nv">category.subcats</span><span class="o">(</span><span class="nv">recurse</span><span class="o">=</span><span class="kp">True</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb5L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb5L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">subcat.path</span><span class="cp">}}</span>: <span class="cp">{{</span><span class="nv">subcat.name</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb5L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb5L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb5L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb5L5"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>Example template code for printing out the directory structure in a nice recursive manner:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb6L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb6L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">subcat</span> <span class="k">in</span> <span class="nv">category.subcats</span> <span class="k">recursive</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb6L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L3"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">subcat.basename</span> <span class="cp">}}</span>: <span class="cp">{{</span> <span class="nv">subcat.name</span> <span class="cp">}}</span></span></span>
<span class="line" id="e170cb6L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L4"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">if</span> <span class="nv">subcat.subcats</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb6L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L5"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">subcat.subcats</span><span class="o">)</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb6L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L6"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb6L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb6L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb6L8"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><p>Categories can also be compared to other categories, which is useful for determining if a subcategory is the same as this one. This snippet will show all of the categories on the website, with the currently-visible one getting a class of <code>here</code> and any parent categories getting a class of <code>parent</code>:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e170cb7L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb7L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">subcat</span> <span class="k">in</span> <span class="nv">category.root.subcats</span><span class="o">(</span><span class="nv">recurse</span><span class="o">=</span><span class="kp">True</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L3"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">subcat</span> <span class="o">==</span> <span class="nv">category</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L4"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;here&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">category.path</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb7L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L5"></a><span class="line-content"><span class="cp">{%</span> <span class="k">elseif</span> <span class="nv">subcat</span> <span class="k">in</span> <span class="nv">category.breadcrumb</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L6"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;parent&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">category.link</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">category.path</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb7L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L8"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">category.link</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">category.path</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e170cb7L9"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L9"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L10"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L10"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e170cb7L11"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb7L11"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure><h2 id="170_h2_1_Meta-files"><a href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#170_h2_1_Meta-files"></a><span id="meta-files">Meta files</span></h2><p>Category data can be added using a metadata file, which is simply a file whose name ends in <code>.cat</code> or <code>.meta</code> and lives somewhere
in the content directory. Similarly to <a href="https://publ.beesbuzz.biz/entry-format">entry files</a>, this will default to using its place in the
content directory for the category to use, but this can also be overridden using a <code>Category:</code> header.</p><p>The headers supported by Publ itself:</p>
<ul>
<li><strong><code>Category</code></strong>: Specifies which category this file refers to</li>
<li><strong><code>Name</code></strong>: Overrides the friendly/display name of the category (i.e. <code>category.name</code>)</li>
<li><span id="template-override"><strong><code>Index-Template</code></strong></span>: Use this template instead of <code>index</code> when rendering this category (useful if you want to override a category or site&rsquo;s index template without overriding its subcategories)</li>
<li><strong><code>Entry-Template</code></strong>: Use this template instead of <code>entry</code> when rendering an entry</li>
<li><strong><code>Sort-Name</code></strong>: The name to use when sorting this in a subcategory list</li>
<li><strong><code>Path-Alias</code></strong>: Redirects an unused path to this category; can optionally take a template parameter</li>
<li><strong><code>Path-Mount</code></strong>: Display an otherwise-unused path as if it&rsquo;s a view of this category; can optionally take a template parameter</li>
</ul>
<p>For example, given the file <code>some/category/info.cat</code>:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e170cb8L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb8L1"></a><span class="line-content">Name: Random Category</span></span>
</pre></figure><p>it will set the <code>name</code> attribute of the <code>some/category</code> category to <code>&quot;Random Category&quot;</code>. However, if the file contains:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e170cb9L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb9L1"></a><span class="line-content">Name: Specific Category</span></span>
<span class="line" id="e170cb9L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb9L2"></a><span class="line-content">Category: other/category</span></span>
</pre></figure><p>then it will set the <code>name</code> attribute of the <code>other/category</code> category to <code>&quot;Specific Category&quot;</code>.</p><p>Similarly to entries, this also supports the <code>Path-Alias</code> and <code>Path-Mount</code> headers; for example:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e170cb10L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb10L1"></a><span class="line-content">Category: /art/sketchbook</span></span>
<span class="line" id="e170cb10L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb10L2"></a><span class="line-content">Path-Alias: /comics/cat-sketchbook.php archive</span></span>
<span class="line" id="e170cb10L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb10L3"></a><span class="line-content">Path-Mount: /sketchbook</span></span>
</pre></figure><p>will redirect requests to <code>/comics/cat-sketchbook.php</code> to the <code>/art/sketchbook</code> category using the <code>archive</code> template (i.e. a path like <code>/art/sketchbook/archive</code>), and requests to <code>/sketchbook</code> will render this category using the default template (without redirecting).</p><p>You can also define any other arbitrary values you like, which will then be put on the category object, and which are
accessible directly via <code>get</code> and <code>get_all</code>. The behavior is the same as on <a href="https://publ.beesbuzz.biz/entry-format">entry files</a>.</p><p>Any text after the headers will be treated as the <code>description</code> for the category. Markdown is supported.</p><p>Note that at least one header is required. If you just want to provide a description and no other configuration,
you can simply start the file with a blank line, or you can use a bogus header, for example:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e170cb11L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb11L1"></a><span class="line-content">Asdf: qwer</span></span>
<span class="line" id="e170cb11L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb11L2"></a><span class="line-content"></span></span>
<span class="line" id="e170cb11L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/170-Category-objects#e170cb11L3"></a><span class="line-content">Here is a description with no real configuration.</span></span>
</pre></figure><p>If you want to change the order of subcategories in a subcategory list, that is easy to do with the <code>Sort-Name</code> property; for example, if you have categories named <code>foo</code>, <code>bar</code>, and <code>baz</code> which you want to appear in that order, you can do something like:</p><figure class="blockcode"><pre><span class="line"><span class="line-content">Sort-Name: 1-foo</span></span>
<span class="line"><span class="line-content"></span></span>
<span class="line"><span class="line-content">Sort-Name: 2-bar</span></span>
<span class="line"><span class="line-content"></span></span>
<span class="line"><span class="line-content">Sort-Name: 3-baz</span></span>
</pre></figure><p>in their respective categories.</p>

]]>
        </content>
    </entry>
    
    <entry>
        <title>Entry objects</title>
        <link href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects" rel="alternate" type="text/html" />
        <published>2018-04-25T14:50:21-07:00</published>
        <updated>2018-04-25T14:50:21-07:00</updated>
        <id>urn:uuid:ceece984-9cde-4323-9bd9-14e9a68044cd</id>
        <author><name>fluffy</name></author>
        <content type="html">
<![CDATA[
<p>The template API for <code>entry</code> objects.</p>

<h2 id="115_h2_1_Default-properties"><a href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#115_h2_1_Default-properties"></a>Default properties</h2><p>The <code>entry</code> object has the following methods/properties:</p>
<ul>
<li><strong><code>id</code></strong>: The numerical entry ID</li>
<li><p><strong><code>title</code></strong>: The title of the entry</p><p>This property can be used directly, or it can take <a href="https://publ.beesbuzz.biz/html-processing">HTML processing arguments</a>, as well as the following:</p>
<ul>
<li><strong><code>always_show</code></strong>: Whether to always show the title, even if the entry isn&rsquo;t authorized; use with caution. (default: <code>False</code>)</li>
</ul></li>
<li><p><span id="summary"><strong><code>summary</code></strong></span>: The entry&rsquo;s <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#summary">summary text</a></p><p>This property can be used directly, or it can take <a href="https://publ.beesbuzz.biz/html-processing">HTML processing arguments</a>, as well as the following:</p>
<ul>
<li><strong><code>always_show</code></strong>: Whether to always show the summary text, even if the entry isn&rsquo;t authorized; use with caution. (default: <code>False</code>)</li>
</ul></li>
<li><p><strong><code>entry_type</code></strong>: The value of the entry&rsquo;s <code>Entry-Type</code> header, if any.</p></li>
<li><p><strong><code>private</code></strong>: Indicates whether this entry is only visible to logged-in users.</p></li>
<li><p><span id="authorized"><strong><code>authorized</code></strong>: Indicates whether this entry is visible to the current user.</span></p></li>
<li><p><span id="body"><strong><code>body</code></strong></span>, <span id="more"><strong><code>more</code></strong></span>, and <span id="footnotes"><strong><code>footnotes</code></strong></span>: The different content sections of an entry.</p><p><code>body</code> is the section above the fold.</p><p><code>more</code> is the section below the fold.</p><p><code>footnotes</code> are the footnotes for the entire entry.</p><p>These properties can be used directly, or they can take any of the following
parameters:</p>
<ul>
<li>The standard <a href="https://publ.beesbuzz.biz/html-processing">HTML processing arguments</a></li>
<li><p><strong><code>footnotes_link</code></strong>: Specifies the base URL for footnote links; defaults to the entry&rsquo;s URL.</p><p>From <code>body</code> and <code>more</code> this refers to the URL the footnotes will display on.</p><p>From <code>footnotes</code> this refers to a URL where the entry text will be visible.</p><p>You can make these different if you want to do something fancy like keeping your footnotes on a separate page (using an archive template or the like); for example,
<code>{{entry.more(footnotes_link=entry.link(template=&#39;footnotes&#39;))}}</code></p></li>
<li><p><strong><code>footnotes_class</code></strong>: Specifies the CSS class for the <code>&lt;sup&gt;</code> that contains the footnote reference link. Defaults to none.</p><p>If you would like to style the <code>&lt;a&gt;</code> element, you can use CSS selectors <code>[rel=&quot;footnote&quot;]</code> and <code>[rev=&quot;footnote&quot;]</code> for the reference and return links, respectively.</p></li>
<li><p><strong><code>footnotes_return</code></strong>: Specifies the text to put inside the return link; defaults to <code>&#39;↩&#39;</code>.</p></li>
<li><p><strong><code>toc_link</code></strong>: The base URL for the heading&rsquo;s anchor link (for use from table of contents or generic permalinks); defaults to the entry&rsquo;s URL.</p></li>
<li><p><strong><code>heading_link_class</code></strong>: The HTML <code>class</code> attribute to add to the self-link from within headings; defaults to none.</p><p>This is useful for e.g. displaying a fancy permalink marker; for example, you can render the entry with:</p><figure class="blockcode"><pre class="highlight" data-language="html" data-line-numbers><span class="line" id="e115cb1L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb1L1"></a><span class="line-content">{{ entry.more(heading_link_class=&#39;toc&#39;)}}</span></span>
</pre></figure><p>and use a stylesheet rule like e.g.</p><figure class="blockcode"><pre class="highlight" data-language="css" data-line-numbers><span class="line" id="e115cb2L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L1"></a><span class="line-content"><span class="p">.</span><span class="nc">toc</span><span class="p">:</span><span class="nd">before</span><span class="w"> </span><span class="p">{</span></span></span>
<span class="line" id="e115cb2L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L2"></a><span class="line-content"><span class="w">    </span><span class="k">position</span><span class="p">:</span><span class="w"> </span><span class="kc">absolute</span><span class="p">;</span></span></span>
<span class="line" id="e115cb2L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L3"></a><span class="line-content"><span class="w">    </span><span class="k">margin-left</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span><span class="kt">ex</span><span class="p">;</span></span></span>
<span class="line" id="e115cb2L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L4"></a><span class="line-content"><span class="w">    </span><span class="k">content</span><span class="p">:</span><span class="w"> </span><span class="s1">&#39;#&#39;</span><span class="p">;</span></span></span>
<span class="line" id="e115cb2L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L5"></a><span class="line-content"><span class="w">    </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#777</span><span class="p">;</span></span></span>
<span class="line" id="e115cb2L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb2L6"></a><span class="line-content"><span class="p">}</span></span></span>
</pre></figure></li>
<li><p><strong><code>heading_link_config</code></strong>: Additional attributes to add to the self-link from within headings (for e.g. <code>title</code> or <code>data-*</code> or the like); defaults to nothing.</p></li>
<li><p><strong><code>heading_template</code></strong>: A template string for how to format headings; takes the following format fragments:</p>
<ul>
<li><strong><code>link</code></strong>: The open link tag (e.g. <code>&lt;a href=&quot;entry#anchor&quot; class=&quot;linkClass&quot;&gt;</code>)</li>
<li><strong><code>text</code></strong>: The formatted text of the heading itself</li>
</ul>
<p>This defaults to <code>{link}&lt;/a&gt;{text}</code> (the <code>&lt;a&gt;</code> is contained within <code>{link}</code>).</p><p>Note that this template will always be rendered inside the heading tags (e.g. <code>&lt;h2 id=&quot;foo&quot;&gt;&lt;a class=&quot;toc&quot; href=&quot;entry#foo&quot;&gt;&lt;/a&gt;Foo&lt;/h2&gt;</code>).</p><p>If you would not like any self-link to be produced for some reason, set <code>heading_template</code> to <code>{text}</code>.</p></li>
<li><p><strong><code>code_highlight</code></strong>: Whether to apply syntax highlighting to code blocks with a declared language (default: <code>True</code>)</p></li>
<li><p><strong><code>code_number_links</code></strong>: Whether to generate line-numbering links within code blocks; see the <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#fenced-code">fenced code extensions</a> for more information. (default: <code>True</code>)</p><p>Set this to a string value to override the base URL for the line number links.</p></li>
</ul></li>
<li><p><span id="toc"><strong><code>toc</code></strong></span>: The table of contents for an entry.</p><p>Renders a table of contents based on the headings of the entry; only applies to Markdown entries.</p><p>In addition to the standard <a href="https://publ.beesbuzz.biz/html-processing">HTML processing arguments</a>, it takes the following arguments:</p>
<ul>
<li><p><strong><code>toc_link</code></strong>: The base URL for links to the entry; defaults to the entry&rsquo;s link.</p></li>
<li><p><strong><code>max_depth</code></strong>: How many levels deep to render</p></li>
</ul></li>
<li><p><span id="card"><strong><code>card</code></strong></span>: <code>&lt;meta&gt;</code> tags for an OpenGraph card</p><p>Like <code>body</code> and <code>more</code>, this takes <a href="https://publ.beesbuzz.biz/manual/335-Image-renditions">arguments that affect the image renditions</a>;
you will almost certainly want to set <code>width</code>, <code>height</code>, and <code>count</code>.</p><p>This will generate an appropriate <code>og:title</code>, <code>og:url</code>, <code>og:image</code>, and <code>og:description</code>
tags based on the entry&rsquo;s permalink and text. <code>og:description</code> contains the <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#summary">entry summary</a>, and there will be <code>og:image</code> tags for up to the first <code>count</code> images.</p><p>If you use this, your template should also provide your own <code>og:type</code> tag, e.g.</p><figure class="blockcode"><pre class="highlight" data-language="html" data-line-numbers><span class="line" id="e115cb3L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb3L1"></a><span class="line-content">{{ entry.card(width=640,height=350,resize=&quot;fill&quot;) }}</span></span>
<span class="line" id="e115cb3L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb3L2"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">property</span><span class="o">=</span><span class="s">&quot;og:type&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;website&quot;</span> <span class="p">/&gt;</span></span></span>
</pre></figure><p>Please see the <a href="http://ogp.me/">OpenGraph documentation</a> for more information.</p><p>This also accepts the <code>markdown_extensions</code> argument, as well as the following additional arguments:</p>
<ul>
<li><p><strong><code>image</code></strong>: A path or URL to an image that should be used as the card image; this can be used to provide a custom property or fallback logic in your template, such as:</p><figure class="blockcode"><pre class="highlight" data-language="html" data-line-numbers><span class="line" id="e115cb4L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb4L1"></a><span class="line-content">{{ entry.card(width=640,height=640,image=entry.get(&#39;card-image&#39;), image_fallback=&#39;default-card.png&#39;) }}</span></span>
</pre></figure>
<ul>
<li><code>None</code> indicates that it should use the first image found in the entry itself (the default) or the value of <code>image_fallback</code> if there&rsquo;s no image in the entry body</li>
<li><code>False</code> indicates that there should be no image at all</li>
</ul></li>
<li><p><strong><code>image_fallback</code></strong>: A path or URL to an image to use if there&rsquo;s no image specified in the entry</p></li>
</ul></li>
<li><p><strong><code>category</code></strong>: The category that this entry belongs to; this is provided as a
<a href="https://publ.beesbuzz.biz/api/category">category object</a>.</p></li>
<li><p><strong><code>date</code></strong>: The publication date and time of the entry, as an <a href="https://arrow.readthedocs.io/en/latest/#arrow.arrow.Arrow">Arrow</a> object.</p><p>This is taken from the entry&rsquo;s <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#date"><code>Date</code> header</a>.</p><p>Since it&rsquo;s an Arrow object you can use it directly to get an incredibly
precise time, but you&rsquo;ll probably want to call a method on it such as
<a href="http://arrow.readthedocs.io/en/latest/#format"><code>format()</code></a> or
<a href="http://arrow.readthedocs.io/en/latest/#humanize"><code>humanize()</code></a>.</p></li>
<li><p><span id="date_grouper"><strong><code>date_year</code></strong>, <strong><code>date_month</code></strong>, <strong><code>date_day</code></strong>: Three pre-defined formats of <code>date</code> for the purpose of making it easier to use Jinja&rsquo;s <a href="http://jinja.pocoo.org/docs/2.10/templates/#groupby"><code>groupby</code></a> functionality.</span></p><p>For example, this snippet will collate the visible entries by month:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e115cb5L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L1"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">month</span><span class="o">,</span><span class="nv">entries</span> <span class="k">in</span> <span class="nv">view.entries</span><span class="o">|</span><span class="nf">groupby</span><span class="o">(</span><span class="s1">&#39;date_month&#39;</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb5L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L2"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">month</span><span class="cp">}}</span></span></span>
<span class="line" id="e115cb5L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L3"></a><span class="line-content">        <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">entry</span> <span class="k">in</span> <span class="nv">entries</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb5L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L4"></a><span class="line-content">        <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">entry.date.format</span><span class="o">()</span><span class="cp">}}</span>: <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span><span class="nv">entry.link</span><span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span><span class="nv">entry.title</span><span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb5L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L5"></a><span class="line-content">        <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb5L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L6"></a><span class="line-content">    <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb5L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb5L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
</pre></figure></li>
<li><p><strong><code>permalink</code></strong>: A permanent link to the entry</p><p>Takes the following arguments:</p>
<ul>
<li><strong><code>absolute</code></strong>: Whether to format this as an absolute or relative URL

<ul>
<li><strong><code>False</code></strong>: Use a relative link (default)</li>
<li><strong><code>True</code></strong>: Use an absolute link</li>
</ul></li>
<li><strong><code>expand</code></strong>: Whether to expand the URL to include the category and slug text

<ul>
<li><strong><code>False</code></strong>: Use a condensed link</li>
<li><strong><code>True</code></strong>: Expand the link to the full entry path (default)</li>
</ul></li>
</ul>
<p>Whether to use an expanded link or not depends on how &ldquo;permanent&rdquo; you want your
permalink to be; a condensed link will always cause a redirect to the current
canonical URL, but an expanded link may go obsolete and still cause a redirection.
The expanded link is generally better for SEO, however, and thus it is the default
even if it isn&rsquo;t truly &ldquo;permanent.&rdquo; (But then again, what <em>is</em> permanent, anyway?)</p></li>
<li><p><strong><code>link</code></strong>: A destination link to the entry</p><p>This is the same as <strong><code>permalink</code></strong> except it will also follow an entry&rsquo;s
<code>Redirect-To</code> destination.</p></li>
<li><p><strong><code>tags</code></strong>: A list of tags associated with this entry.</p></li>
<li><p><strong><code>archive</code></strong>: Get an archive link for rendering this in a category view.</p><p>This takes the following arguments:</p>
<ul>
<li><span id="archive.paging"><strong><code>paging</code></strong>: The pagination type; one of:</span>

<ul>
<li><strong><code>&quot;day&quot;</code></strong>: Entries for that day</li>
<li><strong><code>&quot;month&quot;</code></strong>: Entries for that month</li>
<li><strong><code>&quot;year&quot;</code></strong>: Entries for that year</li>
<li><strong><code>&quot;week&quot;</code></strong>: Entries for that week</li>
<li><strong><code>&quot;offset&quot;</code></strong>: Goes to the page starting with this entry (default)</li>
</ul></li>
<li><strong><code>template</code></strong>: Which template to use for the link (defaults to <code>&#39;&#39;</code>, i.e. the default/index category template)</li>
<li><strong><code>category</code></strong>: Which category to link to; defaults to the entry&rsquo;s own category</li>
<li><strong><code>absolute</code></strong>: Whether to use an absolute link (defaults to <code>False</code>)</li>
<li><strong><code>tag</code></strong>: Limit the view to the specified tag(s)</li>
</ul></li>
<li><p><strong><code>last_modified</code></strong>: A last-modified time for this entry.</p><p>This is taken from the entry&rsquo;s <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#last-modified"><code>Last-Modified</code> header</a>.</p></li>
<li><p><strong><code>next</code></strong>: The next entry (ordered by date)</p><p>This can also take the same arguments as <a href="https://publ.beesbuzz.biz/api#fn-get-view"><code>get_view()</code></a>, with the following differences:</p>
<ul>
<li><code>count</code> has no effect</li>
<li>If <code>category</code> is unspecified, it defaults to the entry&rsquo;s category</li>
</ul>
<p>Examples:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e115cb6L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L1"></a><span class="line-content"><span class="cm">&lt;!-- link to the next entry in its category --&gt;</span></span></span>
<span class="line" id="e115cb6L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L2"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">entry.next</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb6L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L3"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">entry.next.link</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">entry.next.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb6L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L4"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb6L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L5"></a><span class="line-content"></span></span>
<span class="line" id="e115cb6L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L6"></a><span class="line-content"><span class="cm">&lt;!-- link to the next entry in the entire &#39;comics&#39; section where the type isn&#39;t &#39;news&#39; or &#39;recap&#39; --&gt;</span></span></span>
<span class="line" id="e115cb6L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">next_comic</span> <span class="o">=</span> <span class="nv">entry.next</span><span class="o">(</span><span class="nv">category</span><span class="o">=</span><span class="s1">&#39;comics&#39;</span><span class="o">,</span><span class="nv">entry_type_not</span><span class="o">=[</span><span class="s1">&#39;news&#39;</span><span class="o">,</span><span class="s1">&#39;recap&#39;</span><span class="o">])</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb6L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L8"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">next_comic</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb6L9"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L9"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">next_comic.link</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">next_comic.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb6L10"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb6L10"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
</pre></figure></li>
<li><p><strong><code>previous</code></strong>: The previous entry (ordered by date)</p><p>This takes the same arguments as <code>next</code>.</p></li>
<li><p><span id="get"><strong><code>get</code></strong></span>: Get a header from the <a href="https://publ.beesbuzz.biz/entry-format">entry file</a></p><p>This takes the following arguments:</p>
<ul>
<li><strong><code>name</code></strong>: The name of the header to retrieve</li>
<li><strong><code>always_allow</code></strong>: Whether to always retrieve it, even if the entry is unauthorized (default: <code>False</code>)</li>
</ul>
<p>Note that if there&rsquo;s more than one of a header, it&rsquo;s undefined which one this will retrieve.
If you want to get more than one, use <code>get_all</code> instead.</p><p>Header names are not case-sensitive (i.e. <code>&#39;fooBar&#39;</code>, <code>&#39;Foobar&#39;</code>, and <code>&#39;FOOBAR&#39;</code> are all equivalent).</p><p>Note that this will get the <em>raw</em> header values, rather than anything interpreted by Publ. So, for example, <code>entry.get(&#39;date&#39;)</code> will return the <code>Date:</code> header string, rather than the display date of the entry.</p><p>See the section on <a href="https://publ.beesbuzz.biz/manual/api/feed#header-retrieval">header retrieval</a> for more information.</p></li>
<li><p><span id="get_all"><strong><code>get_all</code></strong></span>: Get all of a header type from an entry, as a list.</p><p>This takes the following arguments:</p>
<ul>
<li><strong><code>name</code></strong>: The name of the header to retrieve</li>
<li><strong><code>always_allow</code></strong>: Whether to always retrieve it, even if the entry is unauthorized (default: <code>False</code>)</li>
</ul>
<p>For example, this template fragment
will print out all of the <code>Author</code> headers in an unordered list, but only
if there are any <code>Author</code> headers:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja" data-line-numbers><span class="line" id="e115cb7L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">if</span> <span class="nv">entry.Author</span> <span class="cp">%}</span><span class="c">{# equivalent to entry.get(&#39;Author&#39;) #}</span></span></span>
<span class="line" id="e115cb7L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L2"></a><span class="line-content"><span class="p">&lt;</span><span class="nt">ul</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;authors&quot;</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb7L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L3"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">author</span> <span class="k">in</span> <span class="nv">entry.get_all</span><span class="o">(</span><span class="s1">&#39;Author&#39;</span><span class="o">)</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb7L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L4"></a><span class="line-content">    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">author</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb7L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L5"></a><span class="line-content">    <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span></span></span>
<span class="line" id="e115cb7L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L6"></a><span class="line-content"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span></span></span>
<span class="line" id="e115cb7L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb7L7"></a><span class="line-content"><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span></span></span>
</pre></figure><p>Header names are not case-sensitive (i.e. <code>&#39;fooBar&#39;</code>, <code>&#39;Foobar&#39;</code>, and <code>&#39;FOOBAR&#39;</code> are all equivalent).</p><p>Note that this will get the <em>raw</em> header values, rather than anything interpreted by Publ. So, for example, <code>entry.get_all(&#39;category&#39;)</code> will retrieve the raw text of the <code>Category:</code> header, rather than the entry&rsquo;s <a href="https://publ.beesbuzz.biz/manual/api/170-Category-objects"><code>category</code> object</a>.</p></li>
<li><p><span id="attachments"><strong><code>attachments</code></strong></span>: Other entries which are attached to this one, using the <code>Attach:</code> header.</p><p>This takes the standard <a href="https://publ.beesbuzz.biz/manual/api/150-View-object#subviews">view arguments</a>. Note that the default ordering is undefined, and if order matters you should specify it. For example:</p><figure class="blockcode"><pre class="highlight" data-language="jinja" data-line-numbers><span class="line" id="e115cb8L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb8L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">attachment</span> <span class="k">in</span> <span class="nv">entry.attachments</span><span class="o">(</span><span class="nv">order</span><span class="o">=</span><span class="s1">&#39;oldest&#39;</span><span class="o">)</span> <span class="cp">%}</span></span></span>
</pre></figure><p>will order by date, and</p><figure class="blockcode"><pre class="highlight" data-language="jinja" data-line-numbers><span class="line" id="e115cb9L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb9L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">attachment</span> <span class="k">in</span> <span class="nv">entry.attachments</span><span class="o">(</span><span class="nv">order</span><span class="o">=</span><span class="s1">&#39;title&#39;</span><span class="o">)</span> <span class="cp">%}</span></span></span>
</pre></figure><p>will order them by title (honoring the <code>Sort-Title</code> attribute). You can also sort by arbitrary metadata headers; for example:</p><figure class="blockcode"><pre class="highlight" data-language="jinja" data-line-numbers><span class="line" id="e115cb10L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb10L1"></a><span class="line-content"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">attachment</span> <span class="k">in</span> <span class="nv">entry.attachments</span><span class="o">|</span><span class="nf">sort</span><span class="o">(</span><span class="nv">attribute</span><span class="o">=</span><span class="s1">&#39;My-Custom-Header&#39;</span><span class="o">)}</span> <span class="cp">%}</span></span></span>
</pre></figure></li>
<li><p><strong><code>attached</code></strong>: Like <code>attachments</code>, but it shows the entries that this entry is attached to.</p></li>
<li><p><span id="func-image"><strong><code>image</code></strong></span>: Resolves an image relative to this entry, by path. This is a context-specific version of the <a href="https://publ.beesbuzz.biz/manual/324-Templating-Guide#func-image">global <code>image</code> function</a>.</p></li>
<li><p>The following properties are also available but probably aren&rsquo;t of use to template authors, and are only listed for the sake of completion. You should not rely on them for anything as they might change without warning.</p>
<ul>
<li><p><code>file_path</code>: The file path of the entry&rsquo;s content file</p></li>
<li><p><code>status</code>: The publish status of the entry</p><p>Note that as of Publ 0.3.14 this is a numerical value; in future versions this may change to a string or internal data representation. You should not actually rely on this for anything public.</p></li>
<li><p><code>slug_text</code>: The URL slug text for the entry</p></li>
<li><p><code>redirect_url</code>: The value of the <code>Redirect-To</code> header, if any</p></li>
<li><p><code>sort_title</code>: The value of the <code>Sort-Title</code> header, if any</p></li>
<li><p><code>entry_template</code>: The value of the <code>Entry-Template</code> header, if any</p></li>
<li><p><code>display_date</code>, <code>utc_date</code>, <code>local_date</code>: Various forms of the entry&rsquo;s <code>date</code> used for internal purposes</p></li>
<li><p><code>aliases</code>: The various registered path aliases for this entry. A list of items, each providing the following properties:</p>
<ul>
<li><code>path</code>: The incoming path</li>
<li><code>url</code></li>
<li><code>entry</code></li>
<li><code>category</code></li>
<li><code>template</code></li>
</ul></li>
</ul></li>
</ul>
<h2 id="115_h2_2_Header-retrieval"><a href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#115_h2_2_Header-retrieval"></a><span id="header-retrieval">Header retrieval</span></h2><p>If you have defined <a href="https://publ.beesbuzz.biz/manual/formats/322-Entry-files#headers">custom headers</a>, you can do several different things with them:</p>
<ul>
<li><p>You can always use <code>entry.get(&#39;header-name&#39;)</code>, or <code>entry[&#39;header-name&#39;]</code> which is equivalent. If there are multiple headers of the same name, it is undefined which one this will get.</p></li>
<li><p><code>entry.get_all(&#39;header-name&#39;)</code> will get all of the raw values of a header, as an array. For example, with an entry like:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e115cb11L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb11L1"></a><span class="line-content">Title: My weird day</span></span>
<span class="line" id="e115cb11L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb11L2"></a><span class="line-content">Noun: first noun</span></span>
<span class="line" id="e115cb11L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb11L3"></a><span class="line-content">Noun: second noun</span></span>
<span class="line" id="e115cb11L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb11L4"></a><span class="line-content">Noun: third noun</span></span>
</pre></figure><p>then <code>entry.get_all(&#39;noun&#39;)</code> will return an array like <code>[&#39;first noun&#39;, &#39;second noun&#39;, &#39;third noun&#39;]</code> (although the order isn&rsquo;t guaranteed).</p></li>
<li><p>If the header name is a valid variable name (i.e. starts with a letter or
underscore, and only contains letters, numbers, and underscores), and
doesn&rsquo;t conflict with one of the <a href="https://publ.beesbuzz.biz/manual/api/feed#builtins">built-in properties</a>, you can
also get it using the <code>.</code> operator; for example, in an entry like:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e115cb12L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb12L1"></a><span class="line-content">Title: This is a test</span></span>
<span class="line" id="e115cb12L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb12L2"></a><span class="line-content">Verb: embiggen</span></span>
</pre></figure><p><code>entry.verb</code> will be <code>&#39;embiggen&#39;</code>.</p><p>However, there&rsquo;s always the possibility that a future Publ update might end
up using your custom header name as a built-in property, so you can&rsquo;t be
100% sure that this will continue to work forever.</p></li>
<li><p>The <code>in</code> keyword will let you know if a header exists on an entry; for
example, this template fragment:</p><figure class="blockcode"><pre class="highlight" data-language="html+jinja2" data-line-numbers><span class="line" id="e115cb13L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L1"></a><span class="line-content">&lt;h1&gt;{{entry.title}}&lt;/h1&gt;</span></span>
<span class="line" id="e115cb13L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L2"></a><span class="line-content">{{entry.body}}</span></span>
<span class="line" id="e115cb13L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L3"></a><span class="line-content"></span></span>
<span class="line" id="e115cb13L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L4"></a><span class="line-content">{% if &#39;cut&#39; in entry %}</span></span>
<span class="line" id="e115cb13L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L5"></a><span class="line-content">&lt;details class=&quot;cut&quot;&gt;&lt;summary&gt;{{entry.cut}}&lt;/summary&gt;</span></span>
<span class="line" id="e115cb13L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L6"></a><span class="line-content">{{entry.more}}</span></span>
<span class="line" id="e115cb13L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L7"></a><span class="line-content">&lt;/details&gt;</span></span>
<span class="line" id="e115cb13L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb13L8"></a><span class="line-content">{% endif %}</span></span>
</pre></figure><p>lets you make an entry like this:</p><figure class="blockcode"><pre class="highlight" data-language="publ" data-line-numbers><span class="line" id="e115cb14L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L1"></a><span class="line-content">Title: An entry with a cut</span></span>
<span class="line" id="e115cb14L2"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L2"></a><span class="line-content">Cut: Extreme nerdery</span></span>
<span class="line" id="e115cb14L3"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L3"></a><span class="line-content"></span></span>
<span class="line" id="e115cb14L4"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L4"></a><span class="line-content">Want to hear a secret?</span></span>
<span class="line" id="e115cb14L5"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L5"></a><span class="line-content"></span></span>
<span class="line" id="e115cb14L6"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L6"></a><span class="line-content">.....</span></span>
<span class="line" id="e115cb14L7"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L7"></a><span class="line-content"></span></span>
<span class="line" id="e115cb14L8"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb14L8"></a><span class="line-content">I&#39;m a gigantic nerd.</span></span>
</pre></figure><p>which will render like:</p><figure class="blockcode"><pre><span class="line"><span class="line-content">&lt;h1&gt;An entry with a cut&lt;/h1&gt;</span></span>
<span class="line"><span class="line-content"></span></span>
<span class="line"><span class="line-content">&lt;p&gt;Want to hear a secret?&lt;/p&gt;</span></span>
<span class="line"><span class="line-content"></span></span>
<span class="line"><span class="line-content">&lt;details class=&quot;cut&quot;&gt;&lt;summary&gt;Extreme nerdery&lt;/summary&gt;</span></span>
<span class="line"><span class="line-content">&lt;p&gt;I&#x27;m a gigantic nerd.&lt;/p&gt;</span></span>
<span class="line"><span class="line-content">&lt;/details&gt;</span></span>
</pre></figure><p>Note that this is <em>generally</em> the same as simply doing e.g.</p><figure class="blockcode"><pre class="highlight" data-language="jinja2" data-line-numbers><span class="line" id="e115cb16L1"><a class="line-number" href="https://publ.beesbuzz.biz/manual/api/115-Entry-objects#e115cb16L1"></a><span class="line-content">{% if entry.cut %}</span></span>
</pre></figure><p>but it&rsquo;s slightly more efficient and also can simplify some template logic,
probably.</p></li>
<li><p>If the header name is a valid variable name (i.e. consists of only letters, numbers, and underscores, and starts with a letter or underscore), and doesn&rsquo;t conflict with an API function, you can also retrieve it directly, e.g. <code>entry.Foobar</code> is equivalent to <code>entry.get(&#39;Foobar&#39;)</code>. It is recommended that if you do this, always start the name with a capital letter, to avoid conflicts with any future API functions (e.g. <code>entry.Next</code> will always be equivalent to <code>entry.get(&#39;Next&#39;)</code>).</p><p>You can also check to see if the entry has a header</p></li>
</ul>


]]>
        </content>
    </entry>
    

    
</feed>