Show content on the specific page in ghost

by Enamul Haque in Ghost on March 21, 2019

When we develop our theme, we need to show content only for specific page. It can be homepage, blog page, post page, single page or others. I will show you how to show the content only for the specific page.

  1. To show the content only for homepage {{#is "home"}}{{/is}}
{{#is "home"}}
<p>Showing the content only for homepage</p>
{{/is}}

2. For post page, you can use this code as wrapper {{#is "post"}}{{/is}}

{{#is "post"}}
    <h2>Post title</h2>
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse quisquam, quae repellat eveniet sed suscipit!</p>
{{/is}}

3. For page, you can the content only for page {{#is "page"}}{{/is}}

{{#is "page"}}
    <h2>Page title</h2>
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse quisquam, quae repellat eveniet sed suscipit!</p>
{{/is}}

4. For the Author page, you can show the content only for the authors. {{#is "author"}}{{/is}}

{{#is "author"}}
    <h2>Author Name</h2>
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse quisquam, quae repellat eveniet sed suscipit!</p>
{{/is}}

5. For the Tag page, you can show the tag page content {{#is "tag"}}{{/is}}

{{#is "tag"}}
    <h2>Tag Name</h2>
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse quisquam, quae repellat eveniet sed suscipit!</p>
{{/is}}

6. {{#is "paged"}}{{/is}} is used to show the content only for other pages not on page 1. The page can be 2, 3, 4, 5, or more

{{#is "paged"}}
    <h2>Tag Name</h2>
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse quisquam, quae repellat eveniet sed suscipit!</p>
{{/is}}