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

Ability to fetch resources with helpers #5

Closed
3 tasks done
claviska opened this issue Jul 28, 2016 · 1 comment
Closed
3 tasks done

Ability to fetch resources with helpers #5

claviska opened this issue Jul 28, 2016 · 1 comment

Comments

@claviska
Copy link
Contributor

claviska commented Jul 28, 2016

We need some additional helpers to make templates more useful.

  • {{#posts}}
  • {{#tags}}
  • {{#authors}}

Example usage might look like this:

{{#posts author="bob" query="kittens" count="10" offset="0" sort="newest"}}
    {{#each posts}}
        ...
    {{/each}}
{{/posts}}
@karsasmus
Copy link
Contributor

Added the 3 helpers.

Helper {{#posts}}:

available options:

  • author
    The author's slug
  • count
    Items per Page
  • query
    Searchstring
  • sort
    newest or oldest

Returned fields

  • id
  • slug
  • created
  • pub_date
  • author
  • title
  • content
  • image
  • meta_title
  • meta_description
  • status
  • page
  • featured
  • sticky

If no option is present, the helper returns no data.

Helper {{#tags}}

available options:

  • query
    Wildcard to search in slug an name and Description
  • count
    Items per page
  • sort
    newest or oldest

Returned fields

  • id
  • created
  • slug
  • name
  • description
  • cover
  • meta_title
  • meta_description

If no option is present, the helper returns no data.

Helper {{#authors}}

available options:

  • query
    Wildcard to search the author's slug or name

Returned fields

  • slug
  • name
  • avatar
  • post_count

If no option is present, the helper returns all authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants