How could I display the latest blog post on homepage?
I've already saw the question Bigcommerce Stencil - Display Blog Posts on Homepage and tried it.
But it doesn't show the post body.
My code
blog:
recent_posts:
limit: 1
summary: 100
....
{{#each blog.recent_posts}}
<h2>{{title}}</h2>
<p>{{body}}</p>
view more >>
{{/each}}
Related
In my laravel Project, from the blog details page, I am just copying the URL and pasting it to my Facebook profile. Here, the post only shows the domain and the web title like the attached image.
But I want this image like, there need a post title and post short desc. I am attaching a photo like that. How can I do it in laravel??
So I know how to show recent blogs using
---
blog:
recent_posts:
limit: {{theme_settings.homepage_blog_posts_count}}
---
{{#each blog.recent_posts}}
{{url}}
{{getImage thumbnail 'gallery_size'}}
{{thumbnail.alt}}
{{title}}
{{summary}}
{{/each}}
But is there any other blog data I can pull, and have it on any page??
Can I specify {{thumbnail.alt}} and if so where?
Can I change the number of characters pulled in {{summary}}
Ideally can I pull blog tags somehow on the home page?
I need something, anything I can hide a list of urls in so I can write some javascript to categorize this blog and have certain blog articles appear on certain pages...
There's loads more data available. Check out the stencil documentation and
https://developer.bigcommerce.com/stencil-docs/reference-docs/other-objects-and-properties-overview#other-objects_blog
It looks like you already have the thumbnail alt in there, but here's some more:
limit summary
{{ellipsis summary 75}}
blog tags
{{#each tags}}
<li class="tag">
#{{name}}
</li>
{{/each}}
I think you might be needing to check out 'filter' under handlebar help reference to return just certain blogs / categories though.
https://developer.bigcommerce.com/stencil-docs/reference-docs/handlebars-helpers-reference
There is currently no way to set the image alt tag. It will simply return the title of the post. I will ask the BigCommerce team to look into potentially setting up a way to specify the alt text.
If you need additional control over the blog data, your best bet would be to make AJAX calls to the frontend API to get the data, then manipulate it using JavaScript. You can check out this article I wrote on displaying only posts that are tagged with "featured": https://medium.com/bigcommerce-developer-blog/how-to-feature-a-blog-post-in-bigcommerce-f67d15d36597
The main power comes from this function:
api.getPage('/blog/', options, (error, response) => {})
I'm using shopify which allows a dynamic section on the home page to show 3 blog posts however this only appears on the homepage.
I would like to add the featured blog section that’s used on my Shopify home page, in the bottom of the Blog article template
I have added the {% section ‘featured-blog’ %} to the article.liquid template below {% section ‘article-template’ %} and it displays the 3 blog items but with dummy text and images, it can’t seem to get my actual blog posts? I must be missing something to get the actual blog content but I cant seem to figure it out!
Any ideas or help would be very very appreciated!
Output gets dummy text instead of my blog posts
All is good in your world! You need to navigate to an Article that is assigned to that template within your theme settings panel. Configuration settings for the Index (home page) and that Article template are distinct. It is awaiting your input and currently showing the default fallbacks.
I'm trying to display my only product's salespage on homepage through a shortcode.
I downloaded plugin from github and installed shortcode.liquid and shortcode-render.liquid.
I uploaded shortcode-youtube.liquid example.
I activated shortcode functionality by changing liquid tag from
{{ page.content }}
to
{% include 'shortcode' load: page.content %}
I used shortcode [youtube] on a test page and it works fine! It displays video on a homepage through a shortcode.
Question: How do I do the same for a products sales page?
I know I need to create shortcode-product.liquid file but what code do I put inside it?
Cheers for help,
Rafal
Is it possible to embed different Google+ comment boxes to a post that has different string ids in the url.
For example:
http://www.distressedvolatility.com/p/trending-news.html#3.18771?icx_id=http://www.voanews.com/a/janet-yellen-signals-interest-rate-increase-likely-this-month/3748729.html&showTitle=true
and
http://www.distressedvolatility.com/p/trending-news.html#3.13006?icx_id=28666&showTitle=true
Thanks.
The Google+ comment box shows the comments based on the URL, by default the URL is set via Blogger layout tag (like for example <data:post.canonicalUrl/>) so that the comments are linked to a single URL despite the post URL changing in the address bar (like mobile version appending ?m=1 or different ccTLDs Blogger uses). To render different comment boxes based on the URL, you can change the href parameter to window.location.href. The code for same will look like -
<script src='https://apis.google.com/js/plusone.js' />
<div id='comments'>
</div>
<script>
gapi.comments.render('comments', {
href: window.location.href,
width: '590',
first_party_property: 'BLOGGER',
view_type: 'FILTERED_POSTMOD'
});
</script>