From 329038f71111a5295f19d84909709be97ada39bc Mon Sep 17 00:00:00 2001 From: Toi Yoshimaru <0maru.dev@gmail.com> Date: Mon, 11 Dec 2023 22:57:59 +0900 Subject: [PATCH] =?UTF-8?q?alias=20=E3=82=92=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BaseHead.astro | 2 +- src/layouts/Default.astro | 8 ++++---- src/layouts/Post.astro | 4 ++-- src/pages/about.astro | 4 ++-- src/pages/index.astro | 6 +++--- src/pages/rss.xml.js | 1 + src/pages/tags/[tag].astro | 4 ++-- tsconfig.json | 8 +++++++- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 732438b..94e30fd 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,5 +1,5 @@ --- -import { SITE_URL } from '../consts' +import { SITE_URL } from '@/consts' interface Props { title : string; diff --git a/src/layouts/Default.astro b/src/layouts/Default.astro index b5951f8..3591d90 100644 --- a/src/layouts/Default.astro +++ b/src/layouts/Default.astro @@ -1,8 +1,8 @@ --- -import BaseHead from '../components/BaseHead.astro' -import Footer from '../components/Footer.astro' -import BodyBottomScript from '../components/BodyBottomScript.astro' -import Header from '../components/Header.astro' +import BaseHead from '@/components/BaseHead.astro' +import Footer from '@/components/Footer.astro' +import BodyBottomScript from '@/components/BodyBottomScript.astro' +import Header from '@/components/Header.astro' interface Props { title : string; diff --git a/src/layouts/Post.astro b/src/layouts/Post.astro index f57e631..bfec928 100644 --- a/src/layouts/Post.astro +++ b/src/layouts/Post.astro @@ -1,6 +1,6 @@ --- -import DefaultLayout from './Default.astro' -import Tag from '../components/Tag.astro' +import DefaultLayout from '@/layouts/Default.astro' +import Tag from '@/components/Tag.astro' interface Props { frontmatter : { title : string; diff --git a/src/pages/about.astro b/src/pages/about.astro index 26580a1..21d260a 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -1,6 +1,6 @@ --- -import DefaultLayout from '../layouts/Default.astro' -import { SITE_TITLE, SITE_DESCRIPTION } from '../consts' +import DefaultLayout from '@/layouts/Default.astro' +import { SITE_TITLE, SITE_DESCRIPTION } from '@/consts' --- diff --git a/src/pages/index.astro b/src/pages/index.astro index fae6016..0082b52 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,7 +1,7 @@ --- -import DefaultLayout from '../layouts/Default.astro' -import ArticleCard from '../components/ArticleCard.astro' -import { SITE_TITLE, SITE_DESCRIPTION } from '../consts' +import DefaultLayout from '@/layouts/Default.astro' +import ArticleCard from '@/components/ArticleCard.astro' +import { SITE_TITLE, SITE_DESCRIPTION } from '@/consts' const allPosts = await Astro.glob('../pages/posts/*.md') // status がpublish の記事のみ表示する const filteredPosts = allPosts.filter((e) => e.frontmatter.status == 'published') diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index a3c02a0..ea75a13 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,3 +1,4 @@ +import { SITE_DESCRIPTION, SITE_TITLE } from '@/consts'; import rss from '@astrojs/rss'; import { SITE_DESCRIPTION, SITE_TITLE } from '../consts'; diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro index 5e3d4b0..e1da0b5 100644 --- a/src/pages/tags/[tag].astro +++ b/src/pages/tags/[tag].astro @@ -1,6 +1,6 @@ --- -import DefaultLayout from '../../layouts/Default.astro' -import ArticleCard from '../../components/ArticleCard.astro' +import DefaultLayout from '@/layouts/Default.astro' +import ArticleCard from '@/components/ArticleCard.astro' export async function getStaticPaths() { const allPosts = await Astro.glob('../../pages/posts/*.md') diff --git a/tsconfig.json b/tsconfig.json index ceed42e..ea62c84 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,12 @@ "extends": "astro/tsconfigs/base", "compilerOptions": { "strictNullChecks": true, - "allowJs": true + "allowJs": true, + "baseUrl": ".", + "paths": { + "@/*": [ + "src/*" + ] + } } }