Compare commits
3 commits
74bbae5101
...
ddd73c1412
| Author | SHA1 | Date | |
|---|---|---|---|
| ddd73c1412 | |||
| dcbd8a5980 | |||
| 2e24cbe238 |
3 changed files with 27 additions and 6 deletions
|
|
@ -15,12 +15,12 @@
|
|||
</script>
|
||||
|
||||
<div
|
||||
class="flex items-center gap-2 p-1 text-lg font-bold {className} rounded-lg
|
||||
class="flex flex-nowrap items-center gap-2 p-1 text-lg font-bold {className} rounded-lg
|
||||
{highlightClasses(type == 'published' ? 'bg-amber-600' : 'bg-purple-600')}
|
||||
{highlightClasses('text-slate-50')}"
|
||||
>
|
||||
<Icon {icon} width={28} height={28} />
|
||||
<span>
|
||||
<span class="text-nowrap">
|
||||
{dateString
|
||||
? new Date(dateString).toLocaleString(undefined, {
|
||||
month: 'short',
|
||||
|
|
|
|||
|
|
@ -36,16 +36,17 @@
|
|||
</section>
|
||||
|
||||
<section
|
||||
class="flex shrink-0 flex-col items-center justify-center p-2 font-bold {isPublic
|
||||
class="flex shrink-0 flex-col flex-wrap items-center justify-center p-2 font-bold {isPublic
|
||||
? 'bg-amber-50 text-slate-950'
|
||||
: 'bg-red-500 text-slate-50'} sm:flex-row sm:flex-nowrap sm:gap-5"
|
||||
: 'bg-red-500 text-slate-50'} sm:flex-row sm:gap-x-5"
|
||||
>
|
||||
<DateWidget dateString={data.blogPost.date} type="published" />
|
||||
{#if data.blogPost.dateChanged}
|
||||
<DateWidget dateString={data.blogPost.dateChanged} type="updated" />
|
||||
{/if}
|
||||
{#each authors as author}
|
||||
<a class="flex items-center gap-2 p-1 text-lg font-bold" href="/team/{author}">
|
||||
<!-- TODO: rndtrash: из-за 404 не даёт собрать сайт. href="/team/{author}" -->
|
||||
<a class="flex items-center gap-2 p-1 text-lg font-bold" href="#">
|
||||
<Icon icon="material-symbols:person" width={28} height={28} />
|
||||
<span class="underline">
|
||||
{author}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,26 @@ function makeThumbnail(post: App.BlogPost): string {
|
|||
return `<br><br><img src="https://teasanctuary.ru${resolveBlogPath(post.slug, post.thumbnail)}"${alt}>`;
|
||||
}
|
||||
|
||||
function makeAuthors(post: App.BlogPost): string {
|
||||
const authors =
|
||||
(post.authors == null
|
||||
? []
|
||||
: typeof post.authors === 'string'
|
||||
? [post.authors]
|
||||
: post.authors)
|
||||
.map(a => escapeXml(a));
|
||||
|
||||
if (authors.length === 0) return '';
|
||||
|
||||
let authorsString = authors[0];
|
||||
if (authors.length > 1) {
|
||||
const lastAuthor = authors.pop();
|
||||
authorsString = `${authors.join(', ')} и ${lastAuthor}`;
|
||||
}
|
||||
|
||||
return `\n<author>${authorsString}</author>`;
|
||||
}
|
||||
|
||||
export async function GET({ setHeaders }) {
|
||||
setHeaders({
|
||||
'Cache-Control': 'max-age=0, s-maxage=3600',
|
||||
|
|
@ -36,7 +56,7 @@ export async function GET({ setHeaders }) {
|
|||
<updated>${feedUpdated.toUTCString()}</updated>
|
||||
${posts.map((post) => `<item>
|
||||
<title>${escapeXml(post.title)}</title>
|
||||
<description><![CDATA[${escapeXml(post.description)}${makeThumbnail(post)}]]></description>
|
||||
<description><![CDATA[${escapeXml(post.description)}${makeThumbnail(post)}]]></description>${makeAuthors(post)}
|
||||
<guid isPermaLink="true">https://teasanctuary.ru/blog/${post.slug}</guid>
|
||||
<link>https://teasanctuary.ru/blog/${post.slug}</link>
|
||||
<pubDate>${(new Date(post.date!)).toUTCString()}</pubDate>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue