라우팅 추가 및 CSS 구성

- 개인 블로그
 - 로또
 - 여행

로고 이미지 추가 및 변경
This commit is contained in:
2026-01-18 10:50:45 +09:00
parent cb4978fe4a
commit 8462557ee3
28 changed files with 5727 additions and 674 deletions

79
src/data/blog.js Normal file
View File

@@ -0,0 +1,79 @@
const collectFrontmatter = (raw) => {
const lines = raw.split(/\r?\n/);
const meta = {};
let cursor = 0;
if (lines[0]?.trim() === '---') {
cursor = 1;
for (; cursor < lines.length; cursor += 1) {
const line = lines[cursor].trim();
if (line === '---') {
cursor += 1;
break;
}
if (!line) continue;
const [key, ...rest] = line.split(':');
meta[key.trim()] = rest.join(':').trim();
}
}
const body = lines.slice(cursor).join('\n').trim();
return { meta, body };
};
const extractTitle = (body) => {
const titleLine = body.split(/\r?\n/).find((line) => line.startsWith('# '));
return titleLine ? titleLine.replace(/^#\s+/, '').trim() : '';
};
const extractExcerpt = (body) => {
const lines = body.split(/\r?\n/);
for (const line of lines) {
if (!line.trim()) continue;
if (line.startsWith('#')) continue;
return line.trim();
}
return '';
};
const normalizeTags = (value) => {
if (!value) return [];
return value
.split(',')
.map((tag) => tag.trim())
.filter(Boolean);
};
const normalizeTitle = (slug) =>
slug
.replace(/-/g, ' ')
.replace(/\b\w/g, (letter) => letter.toUpperCase());
export const getBlogPosts = () => {
const modules = import.meta.glob('/src/content/blog/*.md', {
as: 'raw',
eager: true,
});
const posts = Object.entries(modules).map(([path, raw]) => {
const slug = path.split('/').pop().replace(/\.md$/, '');
const { meta, body } = collectFrontmatter(raw);
const title = meta.title || extractTitle(body) || normalizeTitle(slug);
const excerpt = meta.excerpt || extractExcerpt(body);
const date = meta.date || '';
return {
slug,
title,
excerpt,
date,
tags: normalizeTags(meta.tags),
body,
};
});
return posts.sort((a, b) => {
const aDate = Date.parse(a.date || '') || 0;
const bDate = Date.parse(b.date || '') || 0;
return bDate - aDate;
});
};

58
src/data/travel.js Normal file
View File

@@ -0,0 +1,58 @@
export const travelGallery = [
{
id: 'jeju-dawn',
title: 'Jeju Dawn Ride',
location: 'Jeju Island',
month: '2025.04',
image:
'https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?auto=format&fit=crop&w=900&q=80',
},
{
id: 'osaka-night',
title: 'Osaka Night Walk',
location: 'Osaka, Japan',
month: '2024.11',
image:
'https://images.unsplash.com/photo-1467269204594-9661b134dd2b?auto=format&fit=crop&w=900&q=80',
},
{
id: 'taipei-rain',
title: 'Taipei in the Rain',
location: 'Taipei, Taiwan',
month: '2024.08',
image:
'https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=900&q=80',
},
{
id: 'berlin-museum',
title: 'Berlin Museum Day',
location: 'Berlin, Germany',
month: '2024.03',
image:
'https://images.unsplash.com/photo-1441716844725-09cedc13a4e7?auto=format&fit=crop&w=900&q=80',
},
{
id: 'busan-coast',
title: 'Busan Coastline',
location: 'Busan, Korea',
month: '2023.12',
image:
'https://images.unsplash.com/photo-1470770903676-69b98201ea1c?auto=format&fit=crop&w=900&q=80',
},
{
id: 'vietnam-market',
title: 'Hoi An Market',
location: 'Hoi An, Vietnam',
month: '2023.09',
image:
'https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=900&q=80',
},
{
id: 'chiangmai-temple',
title: 'Chiang Mai Temple',
location: 'Chiang Mai, Thailand',
month: '2023.06',
image:
'https://images.unsplash.com/photo-1489515217757-5fd1be406fef?auto=format&fit=crop&w=900&q=80',
},
];