Страница заметки в блоге
This commit is contained in:
parent
f79762b1e0
commit
f0a361c56d
4 changed files with 124 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import path from 'path';
|
||||
|
||||
export const THUMBNAIL_DEFAULT = "https://teasanctuary.ru/common/background-day.webp";
|
||||
|
||||
export async function fetchPostsSorted() {
|
||||
const allPosts = await fetchPosts();
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ export async function fetchPostsSorted() {
|
|||
.filter((a) => !!a.date)
|
||||
.sort((a, b) => {
|
||||
return new Date(b.date!).valueOf() - new Date(a.date!).valueOf();
|
||||
});
|
||||
});
|
||||
|
||||
return sortedPosts;
|
||||
};
|
||||
|
|
@ -31,3 +33,11 @@ export async function fetchPosts() {
|
|||
|
||||
return allPosts;
|
||||
};
|
||||
|
||||
export function resolveBlogPath(slug?: string, src?: string) {
|
||||
if (!src) return null;
|
||||
|
||||
return src.startsWith('http://') || src.startsWith('https://')
|
||||
? src
|
||||
: `/blog/${slug}/${src}`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue