Compare commits
No commits in common. "84512c7a9b62e014d13c6c3ea1227bcbc016a940" and "2610a4466b76256509e5f7d5056583ff144747a4" have entirely different histories.
84512c7a9b
...
2610a4466b
4 changed files with 6 additions and 18 deletions
3
src/app.d.ts
vendored
3
src/app.d.ts
vendored
|
|
@ -22,7 +22,6 @@ declare global {
|
||||||
slug: string;
|
slug: string;
|
||||||
title: string;
|
title: string;
|
||||||
thumbnail?: string;
|
thumbnail?: string;
|
||||||
thumbnailAlt?: string;
|
|
||||||
date?: string;
|
date?: string;
|
||||||
dateChanged?: string;
|
dateChanged?: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
|
@ -33,4 +32,4 @@ declare global {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { };
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,18 @@
|
||||||
>
|
>
|
||||||
{monthYear}
|
{monthYear}
|
||||||
</h1>
|
</h1>
|
||||||
<div class="flex flex-col flex-wrap items-center gap-4">
|
<div class="flex flex-col flex-wrap items-stretch gap-4">
|
||||||
{#each postsInMonthYear as post, i}
|
{#each postsInMonthYear as post, i}
|
||||||
<a
|
<a
|
||||||
href="/blog/{post.slug}"
|
href="/blog/{post.slug}"
|
||||||
class="flex w-full max-w-5xl flex-col justify-baseline overflow-hidden rounded-lg bg-slate-100 text-slate-950 drop-shadow-xl transition-all hover:drop-shadow-2xl sm:flex-row sm:justify-stretch"
|
class="flex flex-col justify-baseline overflow-hidden rounded-lg bg-slate-100 text-slate-950 drop-shadow-xl transition-all hover:drop-shadow-2xl sm:flex-row sm:justify-stretch"
|
||||||
>
|
>
|
||||||
<div class="relative h-32 w-full basis-auto sm:h-auto sm:basis-1/3">
|
<div class="relative h-32 w-full basis-auto sm:h-auto sm:basis-1/3">
|
||||||
{#if post.thumbnail}
|
{#if post.thumbnail}
|
||||||
<img
|
<img
|
||||||
class="absolute h-full w-full object-cover"
|
class="absolute h-full w-full object-cover"
|
||||||
src={`/blog/${post.slug}/${post.thumbnail}`}
|
src={`/blog/${post.slug}/${post.thumbnail}`}
|
||||||
alt={post.thumbnailAlt ?? 'Миниатюра поста'}
|
alt="thumbnail"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="flex shrink-0 flex-col items-center justify-center p-4 font-bold {isPublic
|
class="flex shrink-0 flex-col items-center justify-center p-4 font-bold {isPublic
|
||||||
? 'bg-amber-50 text-slate-950'
|
? 'bg-amber-50 text-slate-950'
|
||||||
|
|
@ -80,8 +79,6 @@
|
||||||
hover:prose-a:transition-all
|
hover:prose-a:transition-all
|
||||||
prose-code:break-words
|
prose-code:break-words
|
||||||
prose-pre:drop-shadow-md
|
prose-pre:drop-shadow-md
|
||||||
mx-auto
|
|
||||||
w-5xl
|
|
||||||
bg-white
|
bg-white
|
||||||
p-4 lg:p-8"
|
p-4 lg:p-8"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { fetchPostsSorted, resolveBlogPath } from "$src/lib/util/Blogs";
|
import { fetchPostsSorted } from "$src/lib/util/Blogs";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
|
|
@ -13,14 +13,6 @@ function escapeXml(unsafe: string): string {
|
||||||
.replace(/'/g, "'");
|
.replace(/'/g, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeThumbnail(post: App.BlogPost): string {
|
|
||||||
if (!post.thumbnail) return '';
|
|
||||||
|
|
||||||
const alt = !!post.thumbnailAlt ? ` alt="${escapeXml(post.thumbnailAlt)}"` : '';
|
|
||||||
|
|
||||||
return `<br><br><img src="https://teasanctuary.ru${resolveBlogPath(post.slug, post.thumbnail)}"${alt}>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function GET({ setHeaders }) {
|
export async function GET({ setHeaders }) {
|
||||||
setHeaders({
|
setHeaders({
|
||||||
'Cache-Control': 'max-age=0, s-maxage=3600',
|
'Cache-Control': 'max-age=0, s-maxage=3600',
|
||||||
|
|
@ -36,7 +28,7 @@ export async function GET({ setHeaders }) {
|
||||||
<updated>${feedUpdated.toUTCString()}</updated>
|
<updated>${feedUpdated.toUTCString()}</updated>
|
||||||
${posts.map((post) => `<item>
|
${posts.map((post) => `<item>
|
||||||
<title>${escapeXml(post.title)}</title>
|
<title>${escapeXml(post.title)}</title>
|
||||||
<description><![CDATA[${escapeXml(post.description)}${makeThumbnail(post)}]]></description>
|
<description>${escapeXml(post.description)}</description>
|
||||||
<guid isPermaLink="true">https://teasanctuary.ru/blog/${post.slug}</guid>
|
<guid isPermaLink="true">https://teasanctuary.ru/blog/${post.slug}</guid>
|
||||||
<link>https://teasanctuary.ru/blog/${post.slug}</link>
|
<link>https://teasanctuary.ru/blog/${post.slug}</link>
|
||||||
<pubDate>${(new Date(post.date!)).toUTCString()}</pubDate>
|
<pubDate>${(new Date(post.date!)).toUTCString()}</pubDate>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue