-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RSS import for blog posts (#253)
Co-authored-by: Zicklag <[email protected]>
- Loading branch information
1 parent
b53cd18
commit cbfd50d
Showing
7 changed files
with
119 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type PostItem = { | ||
title: string; | ||
'dc:creator': string; | ||
pubDate: string; | ||
link: string; | ||
guid: string; | ||
description: string; | ||
category: string[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<script lang="ts"> | ||
import type { PostItem } from '$lib/types/rss'; | ||
import Icon from '@iconify/svelte'; | ||
import { formatDistanceToNow } from 'date-fns'; | ||
export let post: PostItem; | ||
</script> | ||
|
||
<a href={post.link} target="_blank" class="card card-hover"> | ||
<main class="p-4"> | ||
<h3 class=" text-lg font-bold">{post.title}</h3> | ||
<div class="mt-2 flex items-center gap-1"> | ||
<span class="opacity-75"><Icon icon="mdi:calendar" class="h-4 w-4" /></span> | ||
<span class="text-base opacity-70">{formatDistanceToNow(post.pubDate)}</span> | ||
</div> | ||
<div class="mt-2 line-clamp-3 text-base opacity-70"> | ||
{@html post.description} | ||
</div> | ||
|
||
<ul class="mt-2 flex flex-wrap items-center gap-4"> | ||
{#each post.category as category} | ||
<li> | ||
<span class="variant-filled badge">{category}</span> | ||
</li> | ||
{/each} | ||
</ul> | ||
</main> | ||
</a> |