Skip to content

Commit

Permalink
Merge pull request #1223 from CuBoulder/issue/1220
Browse files Browse the repository at this point in the history
Articles: Bylines link to their respective connected Person Pages
  • Loading branch information
jcsparks authored Aug 16, 2024
2 parents 1efd72b + c04b909 commit bf23f61
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions css/ucb-article-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ article.ucb-page-style-dark {
padding-bottom: 1.75em;
}

article.ucb-page-style-dark .ucb-article-author-name a{
color: var(--ucb-gold)
}
article.ucb-page-style-dark .ucb-article-author-name a:hover{
color: var(--ucb-white)
}

/* Override for Dark-style Articles with a Title Image */
article.ucb-page-style-dark:has(.backgroundTitleDiv){
padding-top: 0;
Expand Down
13 changes: 12 additions & 1 deletion templates/field/field--field_ucb_article_byline.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{% for item in items %}
<span>{{item.content|render|striptags|trim}}</span>
{% set byline_entity = item.content['#entity'] %}
{% if byline_entity.field_author_person_page|length > 0 %}
{% set author_person_page_entity = byline_entity.field_author_person_page.0.entity %}
{% if author_person_page_entity %}
{% set url = url('entity.node.canonical', {'node': author_person_page_entity.id()}) %}
<a href="{{ url }}">{{ byline_entity.name.value }}</a>
{% else %}
<span>{{ byline_entity.name.value }}</span>
{% endif %}
{% else %}
<span>{{ byline_entity.name.value }}</span>
{% endif %}
{% endfor %}

0 comments on commit bf23f61

Please sign in to comment.