-
I need some help with figuring out how to add featured posts to a custom home page.
This works for listing the posts, but it only shows the header and excerpt, and no link or image. What I want is for the list to be shown as on the default homepage for the theme, as shown in the demo here, except I don't want the filter to be shown. I figured I could just copy the code from |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hi, sorry Translate :) To get links and display the featured image you need to use the {{url}} and {{featuredImage}} helpers. In your case instead of a custom post/page I would override index.hbs. This is a path I have followed several times to show featured posts in home. The new index.hbs will contain only the elements you are interested (eg. remove the filter and unused JS). For a more scalable solution you can add theme options that allow the default view with filter or the featured post view without filter. Unfortunately I don't know Mercury in detail and these are just general considerations. The error you are getting could also be due to the JS that handles the filter, check your browser console logs to find out more. |
Beta Was this translation helpful? Give feedback.
-
For testing purposes, I created a new page template which is an exact copy of Is this expected behavior or have I found an issue here? If this is expected behavior, could someone elaborate on what I'm doing wrong or missing? As you can see in the conversation above, all attempts at loading the posts/articles in a grid on a page results in the spinning icon appearing and never going away. Maybe @bobmitro or @dziudek can chime in regarding this? Steps to reproduce
|
Beta Was this translation helpful? Give feedback.
-
Hi, Your problem made me curious... Your "Custom homepage HBS" code works perfectly. If I apply it to a page template and set that page as home I see the featured posts correctly: This is because you are using {{getPostsByTags}} instead of {{each posts}}. The problem with index.hbs code not working on page-home.hbs is that {{each posts}} is not reachable from the page structure. |
Beta Was this translation helpful? Give feedback.
Hi,
I'm attaching two versions of the post-home.hbs file: one shows the full list of posts, and the other displays only the featured posts. Both versions work well on my Mercury test site, and I've set them as home pages successfully.
However, the preloader issue still occurs because the Isotope library isn't loaded in the footer. You'll notice that the tag filter doesn’t work on this page. The footer for the full post list isn't being recognized as an "index" for some reason.
To fix this in the footer.hbs file, you’ll need to update this line:
to: