Hello there
I have in blog_item.html.twig the following code to show the author of post:
{% if page.header.author %}
<a href="{{ page.url }}" class="author"><span class="name" rel="author">{{ page.header.author }}</span><img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ page.header.author }}" /></a>
{% endif %}
I’d like to configure in href="" the code to call all articles posted by the author (similiar to list of posts by taxonomy). author is defined in configuration as taxonomy type.
How I can do this?
Thanks in advance.
@pmoreno , What have you tried so far?
pmoreno
October 25, 2021, 10:31am
3
Hi
I have the following:
{% set author = page.header.author %}
{% if author %}
<a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span><img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}" /></a>
{% endif %}
Thanks
pmoreno
October 25, 2021, 10:35am
4
Hi again.
I’ve just find the solution
The correct code is:
<a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span><img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}" /></a>
I’d only to have change /tag to /author
1 Like
@pmoreno , Asking someone else may be easier, but not as fulfilling as finding a solution yourself…
As a bonus, you may mark your reply as ‘solution’.