<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset="utf-8" />
<title>getfield (third party plugin)</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../../style.css" type="text/css" />

<link rel="stylesheet" href="../../local.css" type="text/css" />










</head>
<body>

<article class="page">

<section class="pageheader">
<header class="header">
<span>


<span class="parentlinks">

<a href="../../index.html">ikiwiki</a>/ 

<a href="../../plugins.html">plugins</a>/ 

<a href="../contrib.html">contrib</a>/ 

</span>


<span class="title">
getfield (third party plugin)

</span>
</span>



</header>









</section>





<div id="pagebody">

<section id="content" role="main">
<p><span class="infobox">
Plugin: getfield<br />
Author: <span class="createlink">rubykat</span><br />
Included in ikiwiki: no<br />
Enabled by default: no<br />
Included in <a href="../goodstuff.html">goodstuff</a>: no<br />
Currently enabled: yes<br />
</span></p>

<div class="toc">
	<ol>
		<li class="L2"><a href="#index1h2">NAME</a>
		</li>
		<li class="L2"><a href="#index2h2">SYNOPSIS</a>
		</li>
		<li class="L2"><a href="#index3h2">DESCRIPTION</a>
		</li>
		<li class="L2"><a href="#index4h2">DOWNLOAD</a>
		</li>
	</ol>
</div>


<h2><a name="index1h2"></a>NAME</h2>

<p>IkiWiki::Plugin::getfield - query the values of fields</p>

<h2><a name="index2h2"></a>SYNOPSIS</h2>

<pre><code># activate the plugin
add_plugins =&gt; [qw{goodstuff getfield ....}],
</code></pre>

<h2><a name="index3h2"></a>DESCRIPTION</h2>

<p>This plugin provides a way of querying the meta-data (data fields) of a page
inside the page content (rather than inside a template) This provides a way to
use per-page structured data, where each page is treated like a record, and the
structured data are fields in that record.  This can include the meta-data for
that page, such as the page title.</p>

<p>This plugin is meant to be used in conjunction with the <a href="./field.html">field</a> plugin.</p>

<h3><a name="index1h3"></a>USAGE</h3>

<p>One can get the value of a field by using special markup in the page.
This does not use directive markup, in order to make it easier to
use the markup inside other directives.  There are four forms:</p>

<ul>
<li><p>{{$<em>fieldname</em>}}</p>

<p>This queries the value of <em>fieldname</em> for the source page.</p>

<p>For example:</p>

<pre><code>  [[!meta  title="My Long and Complicated Title With Potential For Spelling Mistakes"]]
  # {{$title}}
</code></pre>

<p>When the page is processed, this will give you:</p>

<pre><code>  &lt;h1&gt;My Long and Complicated Title With Potential For Spelling Mistakes&lt;/h1&gt;
</code></pre></li>
<li><p>{{$<em>pagename</em>#<em>fieldname</em>}}</p>

<p>This queries the value of <em>fieldname</em> for the page <em>pagename</em>.</p>

<p>For example:</p>

<p>On PageFoo:</p>

<p>  [[!meta  title="I Am Page Foo"]]</p>

<p>  Stuff about Foo.</p>

<p>On PageBar:</p>

<p>  For more info, see [[{{$PageFoo#title}}|PageFoo]].</p>

<p>When PageBar is displayed:</p>

<p>  &lt;p&gt;For more info, see &lt;a href="PageFoo"&gt;I Am Page Foo&lt;/a&gt;.&lt;/p&gt;</p></li>
<li><p>{{+$<em>fieldname</em>+}}</p>

<p>This queries the value of <em>fieldname</em> for the destination page; that is,
the value when this page is included inside another page.</p>

<p>For example:</p>

<p>On PageA:</p>

<pre><code>  [[!meta  title="I Am Page A"]]
  # {{+$title+}}

  Stuff about A.
</code></pre>

<p>On PageB:</p>

<pre><code>  [[!meta  title="I Am Page B"]]
  [[!inline  pagespec="PageA"]]
</code></pre>

<p>When PageA is displayed:</p>

<pre><code>  &lt;h1&gt;I Am Page A&lt;/h1&gt;
  &lt;p&gt;Stuff about A.&lt;/p&gt;
</code></pre>

<p>When PageB is displayed:</p>

<pre><code>  &lt;h1&gt;I Am Page B&lt;/h1&gt;
  &lt;p&gt;Stuff about A.&lt;/p&gt;
</code></pre></li>
<li><p>{{+$<em>pagename</em>#<em>fieldname</em>+}}</p>

<p>This queries the value of <em>fieldname</em> for the page <em>pagename</em>; the
only difference between this and {{$<em>pagename</em>#<em>fieldname</em>}} is
that the full name of <em>pagename</em> is calculated relative to the
destination page rather than the source page.</p>

<p>I can't really think of a reason why this should be needed, but
this format has been added for completeness.</p></li>
</ul>


<h3><a name="index2h3"></a>Escaping</h3>

<p>Getfield markup can be escaped by putting a backwards slash <code>\</code>
in front of the markup.
If that is done, then the markup is displayed as-is.</p>

<h3><a name="index3h3"></a>No Value Found</h3>

<p>If no value is found for the given field, then the field name is returned.</p>

<p>For example:</p>

<p>On PageFoo:</p>

<pre><code>[[!meta  title="Foo"]]
My title is {{$title}}.

My description is {{$description}}.
</code></pre>

<p>When PageFoo is displayed:</p>

<pre><code>&lt;p&gt;My title is Foo.&lt;/p&gt;

&lt;p&gt;My description is description.&lt;/p&gt;
</code></pre>

<p>This is because "description" hasn't been defined for that page.</p>

<h3><a name="index4h3"></a>More Examples</h3>

<p>Listing all the sub-pages of the current page:</p>

<pre><code>[[!map  pages="{{$page}}/*"]]
</code></pre>

<h2><a name="index4h2"></a>DOWNLOAD</h2>

<ul>
<li>browse at GitHub: <a href="http://github.com/rubykat/ikiplugins/blob/master/IkiWiki/Plugin/getfield.pm">http://github.com/rubykat/ikiplugins/blob/master/IkiWiki/Plugin/getfield.pm</a></li>
<li>git repo at git://github.com/rubykat/ikiplugins.git</li>
</ul>


</section>







</div>

<footer id="footer" class="pagefooter" role="contentinfo">

<nav id="pageinfo">




<nav class="tags">
Tags:

<a href="../type/format.html" rel="tag">type/format</a>

<a href="../type/meta.html" rel="tag">type/meta</a>

</nav>



<nav id="backlinks">

Links:


<a href="./ymlfront.html">ymlfront</a>


</nav>






<div class="pagedate">
Last edited <time datetime="2026-02-01T09:46:32Z">Sun Feb  1 09:46:32 2026</time>
<!-- Created <time datetime="2026-02-01T09:46:32Z" class="dt-published">Sun Feb  1 09:46:32 2026</time> -->
</div>

</nav>


<!-- from ikiwiki -->
</footer>

</article>

</body>
</html>
