The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

author

{{author}} Helper - Output details of a post's author

Usage: {{author}} or {{#author}}{{/author}}

Type
Parameter
Attributes

n/a

  • autolink (boolean, output only)

Description

The author helper can be used as either an output or block helper, and provides different ways to access and output the information about a post author.

Hint

Switch between the Handlebars and HTML tabs to see the the output from the helper

If used as an output helper (ex. {{author}}) then it will post the name of the author and a link to the authors page.

{{#post}}
    {{author}}       
{{/post}
<a href="/author/jo-bloggs/">Jo Bloggs</a>

If used in the context of a post to display author information (ex. {{#author}}some information{{/author}}), you can display different information such as author name, bio, url, email, etc.

{{#post}}
    {{#author}}
        <h3>{{name}}</h3>
        <p>{{bio}}</p>
    {{/author}}
{{/post}
<h3>Jo Bloggs</h3>
<p>Blogger Extraordinaire</p>

List of Attributes

  • id - the incremental ID of the author
  • name - the name of the author
  • slug - the author's URL slug (used in urls and also useful for class names)
  • bio - the author's bio
  • location - the author's location
  • website - the author's website
  • twitter - the author's twitter username (twitter_url helper)
  • facebook - the author's facebook username (facebook_url helper)
  • profile_image - the author's profile picture (img_url helper)
  • cover_image - the author's cover image
  • url - the web address for the author's page (url helper)

Example Code

{{#post}}
    {{#author}}
        <h3>Written by <a href="{{url}}">{{name}}</a></h3>
        <div>To contact {{name}}, tweet {{twitter}} or visit {{website}}.</div>
    {{/author}}
    <div id="post-content">{{content}}</div>
{{/post}
<h3>Written by <a href="/author/author-slug">Author Name</a></h3>
<div>To contact Author Name, tweet @mytwitter or visit https://mysite.com.</div>
<div id="post-content">
Post content...
</div>
{{#foreach post}}
  <div id="author-header">
    Written by {{author}}. Here is a quick bio:   

    <p id="author-bio">
      {{author.bio}}
    </p>
  </div>

  <div id="post-content">
    {{content words="100"}}
  </div>
{{/foreach}}
<div id="author-header">
  Written by <a href="/author/author-slug/">Author Name</a>. Here is a quick bio:   
  <p id="author-bio">
    Something awesome written about this author.
  </p>
</div>

<div id="post-content">
  100 words of post content...
</div>
<div id="post-footer">
  Written by {{author}}.
	
  {{#author}}
  
    {{#if bio}}
      {{!-- use 3 braces to render HTML in the bio field --}}
      <p id="author-bio">{{{bio}}}</p>
    {{/if}}

    <ul class="author-links">
      {{#if website}}
      <li>
        <i class="author-link fa fa-link"></i>
        <a href="{{website}}">{{website}}</a>
      </li>
      {{/if}}
      {{#if twitter}}
      <li>
        <i class="author-link fa fa-twitter"></i>
        <a href="{{twitter_url}}">{{twitter}}</a>
      </li>
      {{/if}}
      {{#if facebook}}
      <li>
        <i class="author-link fa fa-facebook"></i>
        <a href="{{facebook_url}}">Facebook</a>
      </li>
      {{/if}}
    </ul>
  
  {{/author}}
</div>
<div id="post-footer">
  Written by <a href="/author/author-slug/">Author Name</a>.
	
  <p id="author-bio">Something <strong>awesome</strong> about this author.</p>
 
  <ul class="author-links">
     <li>
      <i class="author-link fa fa-link"></i>
       <a href="https://my-website.com">https://my-website.com</a>
    </li>
    <li>
      <i class="author-link fa fa-twitter"></i>
      <a href="https://twitter.com/myusername">@myusername</a>
    </li>
    <li>
      <i class="author-link fa fa-facebook"></i>
      <a href="https://www.facebook.com/myusername">Facebook</a>
    </li>
  </ul>
</div>

author

{{author}} Helper - Output details of a post's author