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.
Related
I'm fairly new to liquid and Shopify development, but I'm making my way through. I've hit a snag where it seems like what I want to accomplish isn't possible. I'm making a static article page that's primarily HTML, but scattered throughout, I'd like to include instances of a relevant "You Might Like" section to display products.
<HTML>
{% section 'youMightLike' %}
<HTML>
{% section 'youMightLike' %}
I've tried adding a "presets" in the schema tag, and while that allows my section code to be placed anywhere on the homepage and function the way I think it should, my static page only allows for one collection to be chosen (which is then applied to every section on the page).
I've also tried adding blocks to the schema so I could just choose the collection in the block, but that seems to consolidate all the {% section 'youMightLike' %} lines across my entire page.
Am I thinking about this the right way, or is there something else I should be looking into?
Provided your theme is Online Store 2.0 capable, all you need is a unique page template and then you can just add whatever sections are necessary via the customizer.
If it's just a general page or what have you, break your HTML into a section or sections you can include on the page and then you can move around as needed https://shopify.dev/themes/architecture/sections
If your theme isn't 2.0 capable, then you can just create additional sections by modifying them slightly so they're unique. Just copy the section and then modify the name somehow so it's not the same.
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 tried following this guide to create an alternative template for customization.
https://shopify.dev/tutorials/customize-theme-create-alternate-templates
However, every single section edit I makee are global.
For example: I have two page template: pages.alternative1.liquid and pages.alternative2.liquid
Whenever I edit a section on a page with pages.alternative1.liquid, the same
edit affects the same section on pages.alternative2.liquid as well. Is this normal behavior from
Shopify? How should I edit the page then so that a change in one section
doesn't affect all template?
*Note: I am editing the Debut default theme
using Shopify editor: Theme => Customize
Best Regards
Yes this is a normal behavior.
Static sections ( they are the section that are called like so {% section 'your section' %} ) share content between them. This means that if you edit one anywhere it will update everywhere you use it.
On another hand section that are used on the homepage via the {{content_for_index}} tag are dynamic and you can create the same section with different content. (but only on the homepage or where the tag in question is present)
So if you like to have different content on the page a single section will not do you any good. You can create multiply sections with different names in order to use them on different pages, but if you have 5-10+ page it's not a viable option, since it will become too much of a cluster of section files.
What I am trying to do:
I am trying to create an app that inserts content to the merchant's product page.
It appears that an app extension into the merchant's Online Store is the most effective way to do this (see https://shopify.dev/docs/app-extensions/extension-areas#online-store/).
In order to display the content, I am trying to use either a snippet or a section. However, I cannot get either of them to work properly.
I have taken these steps for the snippet:
I have enabled Online store as an extension area within my app (see https://shopify.dev/tutorials/add-a-new-app-extension)
With the Online store extension enabled, I have created a new snippet and a new section with very basic liquid code <h2>{{ product.title }}</h2>
I have enabled my app into a test store on my Shopify Partner account
I have added the {% render 'shopify://apps/etc... %} code into the correct position within the product page
Problem:
The content is not rendered
I have even tried this with the Sections Compatible version of the Debut template (see https://shopify.dev/tutorials/develop-theme-get-started-with-online-store-design-experience). Still nothing.
Is someone able to point me in the right direction here?
i'm trying display diffirent banner on diffirent home page by css
i use %%GLOBAL_PageId%% to display page id but it is not work no thing to display,
%%GLOBAL_PageId%% just work on contact page only
please help,
I check for:
%%GLOBAL_PageNumber%% to check if it is a blog post
%%GLOBAL_PageTitle%% to check if this is a static page (like you mentioned contact page)
%%GLOBAL_CatId%% to check if it is a category page
If none of the above are set, I assume it is a product page. But there are also login, wishlist and other predefined bigcommerce pages that I don't know how can be tracked.