How to Show Featured Posts in Ghost Theme

by ElectronThemes in Ghost on January 19, 2019

We use ghost blog for our blogging. When we want to show our posts as featured, normally we mark it from story settings. We use stories > settings. like this: This will show your post as featured. But when we want to show our featured posts in a specific place, we have to follow the following codes.

  1. First make sure that your plublic API is activated
  2. Use the following code.

Here feature will automatically loop the post as like as foreach

{{#get "posts" filter="featured:true" include="tags,authors"}}
    {{#if posts}}
        <!-- Start Featured Post -->
        {{#foreach posts}}
        <article>
            {{#if feature_image}}
                <img src="{{feature_image}}" alt="{{title}}" /> 
            {{/if}} 
            <h2>{{title}}</h2> 
            {{excerpt words="33"}}
            <a href="{{url}}">Read More</a> 
        </article>
        {{/foreach}}
        <!-- End Featured Post -->
    {{/if}}
{{/get}}
  • For featured posts showing as condition {{#if posts}}{{/if}}
  • For featured post title {{title}}
  • For featured post image {{feature_image}}
  • For Featured post excerpt {{excerpt}}
  • For post url {{url}}

You can see the featured post example in our Writter Ghost Theme.
You can see all of our themes on ElectronThemes.