Типы блог-постов
This commit is contained in:
parent
0643f48189
commit
451d064dea
4 changed files with 50 additions and 6 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import path from 'path';
|
||||
|
||||
export const THUMBNAIL_DEFAULT = "https://teasanctuary.ru/common/background-day.webp";
|
||||
export const BLOG_POST_FRESHNESS_MILLIS = 3 * 24 * 60 * 60 * 1000; // 3 дня
|
||||
|
||||
|
|
@ -60,4 +58,24 @@ export function resolveBlogPath(slug?: string, src?: string) {
|
|||
return src.startsWith('http://') || src.startsWith('https://')
|
||||
? src
|
||||
: `/blog/${slug}/${src}`;
|
||||
}
|
||||
}
|
||||
|
||||
const bptToString: Record<App.BlogPostType, string> = {
|
||||
'article': 'Заметка',
|
||||
'event': 'Событие',
|
||||
'update': 'Обновление'
|
||||
};
|
||||
|
||||
const bptToIcon: Record<App.BlogPostType, string> = {
|
||||
'article': 'material-symbols:article',
|
||||
'event': 'material-symbols:event',
|
||||
'update': 'material-symbols:autorenew'
|
||||
};
|
||||
|
||||
export function blogPostTypeToString(type: App.BlogPostType): string {
|
||||
return bptToString[type] ?? bptToString['article'];
|
||||
}
|
||||
|
||||
export function blogPostTypeToIcon(type: App.BlogPostType): string {
|
||||
return bptToIcon[type] ?? bptToIcon['article'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue