Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Lists with all records in a multiple-section #34

Closed
JLKM opened this issue Sep 23, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@JLKM
Copy link

commented Sep 23, 2018

Plain html-templates as the workhorse of an entire website setup design and control - database definitions included... Really nice idea! Makes web-publishing much more transparent than usual.

A couple of extra features to consider:

  1. Dynamic lists showing all records in a multiple-section.
  2. If and unless testing not only for content in a field - but also for presence of a certain string (like indexOf()).

@srobbin srobbin added the feature label Sep 24, 2018

@srobbin

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2018

@JLKM Thank you.

Can you explain Dynamic Lists a little more? I'm not sure understand.

@JLKM

This comment has been minimized.

Copy link
Author

commented Sep 24, 2018

Sure. I imagine an array of objects containing certain/selected fields from each multiple-section for traversal. This array might be accessible in order to feed a forall-method (like if and unless) - perhaps with a certain upper limit. The result would be a way to create a list of headlines with links for navigation.

@srobbin

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2018

@JLKM Thanks for the explanation. If I'm understanding correctly, I think you should be able to do something similar now. For example, let's say you have a repeating section for blog posts:

{{#section blog_posts}}
  {{title}}
  {{body type=html}}
{{/section}}

And you want to create a sidebar on your homepage with titles/links to the first 5 blog posts. You could do this:

<ul>
  {{#section blog_posts limit=5}}
  <li><a href="{{_permalink}}">{{title}}</a></li>
  {{/section}}
</ul>

Check out the "Link to Repeating Content" section in the docs for more info: https://docs.vapid.com/learn-more#sections

@JLKM

This comment has been minimized.

Copy link
Author

commented Sep 25, 2018

My bad. Missed that trick in the docs. And my applause for both usefullness and simplicity at the same time.

Still can't get the list to work with three articles, though.

I would expect the nav to the left to show a list with all three articles. But only one - the same as to the right - shows up. Removing multiple=true doesn't change anything.

Relevant code snippet from _articles.html:

  <section>
    <div>
      <div id="nav">
        <ul>
          {{#section articles multiple=true limit=5}}
          <li>
            <h4><a href="{{_permalink}}">{{title}}</a></h4>
            <h5>{{subtitle}}</h5>
          </li>
          {{/section}}
        </ul>
      </div>
      <div id="content" class="container">
        {{#section articles}}
        <h1>{{title}}</h1>
        <h3>{{subtitle}}</h3>
        <h5>Category: {{category}}</h5>
        <strong>{{intro long=true}}</strong>
        {{#if author}}
        <i>{{author}}</i>
        <div class="ui alert message">
          <strong>Author alert: {{author}} on the loose</strong>
        </div>
        {{/if}}
        {{body type=html}}
        {{/section}}
      </div>
    </div>
  </section>

billede

@srobbin

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2018

Ah, I see now. That looks like a bug, or rather a shortcoming of the way I designed detail pages. Vapid doesn't know how to pass in an array for the nav section, and a single entry for the content. It's just passing in a single entry for all #section articles tags. I'll look into it.

@srobbin srobbin self-assigned this Sep 25, 2018

@srobbin srobbin added bug and removed feature labels Sep 25, 2018

@JLKM

This comment has been minimized.

Copy link
Author

commented Sep 25, 2018

Excellent. Really appreciate your brilliant work.

@cctuan

This comment has been minimized.

Copy link

commented Dec 23, 2018

That'll be better if it can have an option to ignore the original article.

srobbin added a commit that referenced this issue Jun 12, 2019

@srobbin srobbin closed this in #146 Jun 12, 2019

srobbin added a commit that referenced this issue Jun 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.