WebCompany
WebCompany

Reputation: 23

Blog Image not Display in Home Page Big-commerce - Stencil

This is the code I have for Home.html

<br/><br/>
{{#each blog.recent_posts}}
<br/><br/>
{{> components/blog/post post=this settings=../settings}}
<br/><br/>
{{/each}}

This is the code I have for Post.html

<br/>
<"header class="blog-header"><br/>
    <"/h2 class="blog-title"><br/>
    <"img src="{{getImage thumbnail 'blog_size'}}" alt="{{thumbnail.alt}}" title="{{thumbnail.alt}}">
        <br/>
        <a href="{{post.url}}">{{post.title}}</a><br/>
    </h2>
    <br/>
    <p class="blog-date">{{#if post.author}}{{lang 'blog.posted_by' name=post.author}} on {{/if}}{{post.date_published}}</p><br/>
</header>
<br/>

Upvotes: 0

Views: 102

Answers (2)

Daniel Del Core
Daniel Del Core

Reputation: 3221

There seems to be some syntactical issues with your markup.

{{#each blog.recent_posts}}

    {{> components/blog/post post=this settings=../settings}}

{{/each}}

Post.html

<header class="blog-header">
    <h2 class="blog-title">
        {{post.title}}
    </h2>
    <img src="{{getImage thumbnail 'blog_size'}}" alt="{{thumbnail.alt}}" title="{{thumbnail.alt}}"> 

    {{#if post.author}}
        {{lang 'blog.posted_by' name=post.author}} on 
    {{/if}}

    {{post.date_published}}
</header>

Upvotes: 1

R.K.Bhardwaj
R.K.Bhardwaj

Reputation: 2192

In stencil, you need to remove post. since the global blog.recent_posts structure if different than blog.posts and for some reason.

{{#each blog.recent_posts}}
        {{#if thumbnail}}
            <figure class="blog-thumbnail">
                <a href="{{url}}">
                    <img src="{{getImage thumbnail 'blog_size'}}" alt="{{thumbnail.alt}}" title="{{thumbnail.alt}}">
                </a>
            </figure>
        {{/if}}
    {{/each}}

Upvotes: 0

Related Questions