Handling Article Authors¶
Listing a Single Article’s Author¶
Usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <ul>
{% gimme author with { id: 1 } %}
<li>{{ author.name }}</li> <!-- Author's name -->
<li>{{ author.role }}</li> <!-- Author's name -->
<li>{{ author.biography }}</li> <!-- Author's biography -->
<li>{{ author.jobTitle.name }}</li> <!-- Author's job title name -->
<li>{{ author.jobTitle.qcode }}</li> <!-- Author's job title code -->
{% if author.avatar %}<li> <img src="{{ url(author.avatar) }}"><li>{% endif %} <!-- Author's avatar url. Check first if it's not null - author can be without avatar. -->
<li>{{ author.facebook }}</li> <!-- Author's Facebook -->
<li>{{ author.instagram }}</li> <!-- Author's Instagram -->
<li>{{ author.twitter }}</li> <!-- Author's Twitter -->
{% endgimme %}
</ul>
|
Parameters:
1 | {% gimme author with { id: 1 } %} {{ author.name }} {% endgimmelist %} - select author by it's id.
|
1 | {% gimme author with { name: "Tom" } %} {{ author.name }} {% endgimmelist %} - select author by it's name.
|
Listing a collection of Article’s Authors¶
Usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <ul>
{% gimmelist author from authors with { role: ["writer"] } without {role: ["subeditor"]} %}
<li>{{ author.name }}</li> <!-- Author's name -->
<li>{{ author.role }}</li> <!-- Author's role -->
<li>{{ author.biography }}</li> <!-- Author's biography -->
<li>{{ author.jobTitle.name }}</li> <!-- Author's job title name -->
<li>{{ author.jobTitle.qcode }}</li> <!-- Author's job title code -->
{% if author.avatar %}<li> <img src="{{ url(author.avatar) }}"><li>{% endif %} <!-- Author's avatar url. Check first if it's not null - author can be without avatar. -->
<li>{{ author.facebook }}</li> <!-- Author's Facebook -->
<li>{{ author.instagram }}</li> <!-- Author's Instagram -->
<li>{{ author.twitter }}</li> <!-- Author's Twitter -->
{% endgimmelist %}
</ul>
|
The above twig code, will render the list of articles where author’s role is writer
and is not subeditor
.
Filter authors by author’s name:
1 2 3 | {% gimmelist author from authors with { name: ["Tom"] } %}
{{ author.name }}
{% endgimmelist %}
|
Filter authors by author’s slug (automatically created from name. Example: John Doe -> john-doe):
1 2 3 | {% gimmelist author from authors with { slug: ["john-doe"] } %}
{{ author.name }}
{% endgimmelist %}
|
Filter authors by author’s name and role:
1 2 3 | {% gimmelist author from authors with { role: ["Writer"], name: ["Tom"] } %}
{{ author.name }}
{% endgimmelist %}
|
Filter authors by job title:
1 2 3 4 5 6 7 | {% gimmelist author from authors with {jobtitle: {name: "quality check"}} %}
{{ author.name }}
{% endgimmelist %}
{% gimmelist author from authors with {jobtitle: {qcode: "123"}} %}
{{ author.name }}
{% endgimmelist %}
|