Feature particular posts on another page


#1

Just gotta say I think Vapid is a great idea.

I’ll be posting projects on my Vapid experimental site and I was wondering if there’s a way to be able to have a “featured” check option and then on another page pull and list any of those particular posts that have that field checked? I think it would have to involve a while statement—don’t know if Vapid has those capabilities yet.

For example, I have a _project.html file for each particular project that has a checkbox field for if I want to feature it or not.

Then I have my index page I have a list as well but I check to see if the featured checkbox was checked and then list the fields. It lists four unfilled lists, instead of the two that I had checked feature.

Thanks!


#2

@jcbbuller First off, thanks for the kind words about Vapid!

It sounds like you’re running to this bug, where Vapid doesn’t recognize {{#if feature}} unless it sees it inside the section block too. For experiment’s sake, try something like this for your list:

<ul>
  {{#section projects}}
    {{#if feature}}
      <li>
        <h3>{{title}}</h3>
        {{shortparagraph1}}
      </li>
    {{/if}}
    {{feature type=choice}}
  {{/section}}
</ul>

Obviously, you shouldn’t have to add the second {{feature type=choice}}. I’m looking into this one, and should have a fix soon. I’ll try to remember to update this forum thread afterward, but please keep an eye on the GitHub issue just in case I forget.