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    

facebook_url

{{facebook_url}} Helper - output a full url for a facebook username or page name.

Usage: {{facebook_url}} or {{facebook_url @blog.facebook}} or {{facebook_url "myfavouritepage"}}

Type
Parameters
Attributes

facebook username (string) (optional)

n/a

Description

This helper exists to make it easy to output a URL for a facebook page. Ghost has access two facebook page names/usernames for both users and for the blog itself. When used without passing a username, the helper will look for a facebook username in the current template context, and then fallback to using @blog.facebook.

If there is no facebook username set, the helper will output nothing at all.

If you pass a variable or string to the helper, it will concatenate the value with the full url for a facebook page.

Examples

Output the author's facebook, using an author block:

{{#foreach posts}}
  {{#author}}
    {{#if facebook}}<a href="{{facebook_url}}">Follow me on Facebook</a>{{/if}}
  {{/author}}
{{/foreach}}
<a href="https://www.facebook.com/myfacebook">Follow me on Facebook</a>

Output the author's facebook, without an author block:

{{#post}}
	<h1>{{title}}</h1>
  <p class="meta">Written by {{author}}, follow me on <a href="{{facebook_url author.facebook}}">facebook</a>!</p>
{{/post}}
<h1>My Post</h1>
<p class="meta">Written by <a href="/author/author-slug">Author Name</a>, follow me on <a href="https://www.facebook.com/myfacebook">facebook</a>!</p>

Output the blog's facebook url in the footer:

<footer class="site-footer clearfix">
  <section class="copyright">
    <a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}
  </section>
  <section class="facebook">
  	{{!-- @blog.facebook is the default, so we don't have to specify --}}
    <a href="{{facebook_url}}">facebook.com/{{@blog.facebook}}</a>
  </section>
  <section class="poweredby">
    Proudly published with <a href="https://ghost.org">Ghost</a>
  </section>
</footer>
<footer class="site-footer clearfix">
  <section class="copyright">
    <a href="https://my-ghost-blog.com">My Ghost Blog</a> &copy; 2016
  </section>
  <section class="facebook">
    <a href="https://www.facebook.com/myghostblog">facebook.com/myghostblog</a>
  </section>
  <section class="poweredby">
    Proudly published with <a href="https://ghost.org">Ghost</a>
  </section>
</footer>

Output a link to any facebook page:

<p>I'm a real fan of <a href="{{facebook_url "GhostbustersOfficial"}}">Ghostbusters!</a></p>
<p>I'm a real fan of <a href="https://www.facebook.com/GhostbustersOfficial">Ghostbusters!</a></p>

facebook_url

{{facebook_url}} Helper - output a full url for a facebook username or page name.