Ad

How Can I Read The Blog Entries On My Page In Shopify

Sorry for my weak technical language. I am playing with the Shopify and get stuck on an issue.

So, the issue is, I have some blog entries, say testimonials. I am trying to display these testimonials on every page.

this is my sample blog entries

sample blog entries

this is a page which will use the blog entries

 {% for article in blog.articles %}
    <ul class="news">
        <li><span class="testimonial">"{{ article.content }}"</span>
        <p class="author">{{ article.title }}</p>
        </li>
    </ul>
    {% endfor %}

some random page

I figure it out I cant access the blog on my page... when I try this code on the page to access the blog entries.. it did not work. but it is working if I use it on 'blog.xyz'enter image description here

so my problem is, how can I read the blog entries on any page. I am thank full to all the developers...

Ad

Answer

To access the testimonials in your custom page use this snippet (in the above example this should be placed in "page.rug-cleaning.liquid"):

{% for article in blogs.testimonials.articles %}
    <ul class="news">
        <li><span class="testimonial">"{{ article.content }}"</span>
        <p class="author">{{ article.title }}</p>
        </li>
    </ul>
{% endfor %}
Ad
source: stackoverflow.com
Ad