Skip to content

Commit

Permalink
Fix article image alt attribute (#253)
Browse files Browse the repository at this point in the history
PR #252 dropped the alt text to support HTML in the image credits, but a
more accessible fix here is just strip the HTML from the image credits
when using the credits in the attribute.
  • Loading branch information
agjohnson authored Feb 2, 2024
1 parent 6fd5d4f commit 5a06180
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readthedocs_theme/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<div class="ui divider"></div>

<img class="ui big rounded centered image" src="{{ article.image or '/images/posts/default.svg' }}" alt="{{ article.image }}">
<img class="ui big rounded centered image" src="{{ article.image or '/images/posts/default.svg' }}" alt="{{ article.image_credit|striptags }}">
{% if article.image and article.image_credit %}
<div class="ui basic center aligned segment">
<p><i>{{ article.image_credit}}</i></p>
Expand Down
2 changes: 1 addition & 1 deletion readthedocs_theme/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% macro article_card(article) %}
<a class="ui card" href="/{{ article.url }}">
<div class="image">
<img src="{{ article.image or '/images/posts/default.svg'}}" alt="{{ article.image }}">
<img src="{{ article.image or '/images/posts/default.svg'}}" alt="{{ article.image_credit|striptags }}">
</div>
<div class="content">
<div class="header">{{ article.title }}</div>
Expand Down

0 comments on commit 5a06180

Please sign in to comment.