-
Notifications
You must be signed in to change notification settings - Fork 40
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
plugins/news: Add support for multiple post authors #111
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,18 +10,18 @@ <h1>{{ title }}</h1> | |
{# Post content #} | ||
<p style="font-size: small;"> | ||
Posted on <time>{{ date|date:"Y-m-d" }}</time> | ||
{% if author %} | ||
{% if authors %} | ||
by | ||
{% for author in authors|slice:":-2" %} | ||
<span class="author">{% if author.url %}<a href="{{ author.url }}">{{ author.name }}</a>{% else %}{{ author.name }}{% endif %}{% if author.github %} (<a href="https://github.com/{{ author.github }}">@{{ author.github }}</a>){% endif %}</span>, | ||
{% endfor %} | ||
{% for author in authors|slice:"-2:-1" %} | ||
<span class="author">{% if author.url %}<a href="{{ author.url }}">{{ author.name }}</a>{% else %}{{ author.name }}{% endif %}{% if author.github %} (<a href="https://github.com/{{ author.github }}">@{{ author.github }}</a>){% endif %}</span> and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not very familiar with cactus, but is there any way to reduce the duplication using a macro or smth? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really. We could put it into a separate template and include that here, but that also would also lead to superfluous newlines |
||
{% endfor %} | ||
{% for author in authors|slice:"-1:" %} | ||
<span class="author"> | ||
{% if author_url %} | ||
<a href="{{ author_url }}">{{ author }}</a> | ||
{% else %} | ||
{{ author }} | ||
{% endif %} | ||
{% if author_github %} | ||
(<a href="https://github.com/{{ author_github }}">@{{ author_github }}</a>) | ||
{% endif %} | ||
</span> | ||
{% if author.url %}<a href="{{ author.url }}">{{ author.name }}</a>{% else %}{{ author.name }}{% endif %}{% if author.github %} (<a href="https://github.com/{{ author.github }}">@{{ author.github }}</a>){% endif %}</span> | ||
{% endfor %} | ||
{% endif %} | ||
</p> | ||
{% block post %}{% endblock %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this is a single line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because otherwise it will insert newlines into the HTML source, which creates a space before the comma.