Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-socks-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudfour/patterns': minor
---

Don't allow line breaks in author names
7 changes: 7 additions & 0 deletions src/components/author/author.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
.c-author {
color: var(--theme-color-text-muted);
}

/**
* 1. Prevent breaking inside author names
*/
.c-author__author {
display: inline-block; /* 1 */
}
12 changes: 6 additions & 6 deletions src/components/author/author.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@
{# Author content #}
<div class="c-author__content-container o-media__content">
{# Author links #}
<p class="c-author__author">
<p>
<span class="u-hidden-visually">{{ author_prefix|default("By") }}</span>
{% block authors %}
{% for author in authors %}
{% if loop.last and loop.length > 1 %}and {% endif %}
{%- if author.link and not unlink -%}
<a href="{{ author.link }}">{{ author.name }}</a>
{%- else -%}
<span>{{ author.name }}</span>
{%- endif -%}
{%- if author.link and not unlink -%}
<a class="c-author__author" href="{{ author.link }}">{{ author.name }}</a>
{%- else -%}
<span class="c-author__author">{{ author.name }}</span>
{%- endif -%}
{%- if not loop.last and loop.length > 2 %},{% endif %}
{% endfor %}
{% endblock %}
Expand Down