Add yazzy link to each article

This commit is contained in:
Carter McBride 2024-07-04 14:51:42 -06:00
parent bcfd79f6a5
commit bb9e38bb3b
4 changed files with 13 additions and 1 deletions

View file

@ -122,6 +122,11 @@
<div class="article-timestamp"> <div class="article-timestamp">
<relative-time data-time="{{item.timestamp}}">{{ item.timestamp | relative}}</relative-time> <relative-time data-time="{{item.timestamp}}">{{ item.timestamp | relative}}</relative-time>
</div> </div>
{% if yazzyUrl %}
<div class="article-links">
<a href="{{ yazzyUrl }}/{{ item.link }}" target="_blank" rel="noreferrer noopener">yazzy</a>
</div>
{% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View file

@ -69,7 +69,8 @@ details:has(li.has-recent) {
} }
.article-timestamp, .article-timestamp,
.feed-url { .feed-url,
.article-links {
font-size: 0.75em; font-size: 0.75em;
} }

View file

@ -88,6 +88,7 @@ const finishBuild: () => void = async () => {
data: sortedFeeds, data: sortedFeeds,
errors: errors, errors: errors,
info: buboInfo, info: buboInfo,
yazzyUrl: process.env.YAZZY_URL,
}); });
// write the output to public/index.html // write the output to public/index.html

View file

@ -10,6 +10,8 @@ import { readFile } from "node:fs/promises";
import { getRelativeTime } from "@feelinglovelynow/get-relative-time"; import { getRelativeTime } from "@feelinglovelynow/get-relative-time";
import type { Feeds, JSONValue } from "./@types/bubo"; import type { Feeds, JSONValue } from "./@types/bubo";
const yazzyUrl = process.env.YAZZY_URL;
/** /**
* Global filters for my Nunjucks templates * Global filters for my Nunjucks templates
*/ */
@ -35,15 +37,18 @@ const render = ({
data, data,
errors, errors,
info, info,
yazzyUrl,
}: { }: {
data: Feeds; data: Feeds;
errors: unknown[]; errors: unknown[];
info?: JSONValue; info?: JSONValue;
yazzyUrl?: string;
}) => { }) => {
return env.renderString(template, { return env.renderString(template, {
data, data,
errors, errors,
info, info,
yazzyUrl,
}); });
}; };