Use thumbnail_url_small whenever possible in newsfeed #13

Merged
finn merged 1 commit from diamond/devhack.net:newsfeed-thumbnail-small into main 2025-07-20 01:46:38 -04:00

View file

@ -29,7 +29,7 @@ respective origins, and so they do not exist in git:
```sh
# in the root of the repository, run:
curl -o calendar.ics https://devhack.net/calendar.ics
curl -o spaceapi.json https://devhack.net/spaceapi.json
curl -o news.json https://devhack.net/news.json
curl -Lo calendar.ics https://devhack.net/calendar.ics
curl -Lo spaceapi.json https://devhack.net/spaceapi.json
curl -Lo news.json https://devhack.net/news.json
```

View file

@ -81,6 +81,7 @@ async function fetchNewsFeed(afterID = null) {
username: item.author.username,
content: item.content,
thumbnailURL: item.thumbnail_url,
thumbnailURLSmall: item.thumbnail_url_small,
tracTicketID: item.trac_ticket_id,
})
);
@ -112,6 +113,7 @@ function createNewsItem({
username,
content,
thumbnailURL,
thumbnailURLSmall,
tracTicketID,
}) {
const newsItem = newsItemTemplate.content.firstElementChild.cloneNode(true);
@ -138,7 +140,8 @@ function createNewsItem({
elem(newsItem, ".news-thumbnail-link").href = thumbnailURL;
elem(newsItem, ".news-thumbnail-link").target = "_blank";
elem(newsItem, ".news-thumbnail-image").src = thumbnailURL;
elem(newsItem, ".news-thumbnail-image").src = thumbnailURLSmall ??
thumbnailURL;
elem(newsItem, ".news-thumbnail-image").alt = `thumbnail image for post`;
}