The Node.js® Website
at main 756 B view raw
1import type { BlogPreviewType } from '@/types'; 2 3export const mapBlogCategoryToPreviewType = (type: string): BlogPreviewType => { 4 switch (type) { 5 case 'announcements': 6 case 'release': 7 case 'vulnerability': 8 return type; 9 case 'events': 10 return 'announcements'; 11 default: 12 return 'announcements'; 13 } 14}; 15 16// @todo: we should check about the future of GitHub avatars 17// and mapping them to the respective users 18// @see https://github.com/nodejs/nodejs.dev/blob/main/src/data/blog/authors.yaml 19export const mapAuthorToCardAuthors = (author: string) => { 20 const authors = author.split(/, | and |;| by /i); 21 22 return authors.map(fullName => ({ 23 fullName, 24 src: `https://ui-avatars.com/api/?name=${fullName}`, 25 })); 26};