- - {post.title} - + { + link ? ( + + {post.title} + + ) : ( + post.title + ) + }
diff --git a/src/components/common/Tags.astro b/src/components/common/Tags.astro index d2a6285..c938945 100644 --- a/src/components/common/Tags.astro +++ b/src/components/common/Tags.astro @@ -1,6 +1,7 @@ --- import { getPermalink } from '~/utils/permalinks'; +import { BLOG } from '~/config.mjs'; import type { Post } from '~/types'; export interface Props { @@ -16,7 +17,7 @@ const { tags, class: className = 'text-sm' } = Astro.props;
diff --git a/src/config.mjs b/src/config.mjs index 2a4aee0..93c858b 100644 --- a/src/config.mjs +++ b/src/config.mjs @@ -1,6 +1,6 @@ import defaultImage from './assets/images/default.png'; -export const SITE = { +const CONFIG = { name: 'AstroWind', origin: 'https://astrowind.vercel.app', @@ -9,39 +9,42 @@ export const SITE = { title: 'AstroWind — Your website with Astro + Tailwind CSS', description: '🚀 AstroWind is a free and ready to start template to make your website using Astro and Tailwind CSS.', - defaultImage: defaultImage, - defaultTheme: "system", // "system" | "light" | "dark" | "light:only" | "dark:only" + + defaultTheme: 'system', // Values: "system" | "light" | "dark" | "light:only" | "dark:only" googleAnalyticsId: false, // or "G-XXXXXXXXXX", googleSiteVerificationId: 'orcPxI47GSa-cRvY11tUe6iGg2IO_RPvnA1q95iEM3M', -}; - -export const BLOG = { - disabled: false, - postsPerPage: 4, blog: { disabled: false, - pathname: 'blog', // blog main path, you can change this to "articles" (/articles) - noindex: false, - }, + postsPerPage: 4, - post: { - disabled: false, - pathname: '', // empty for /some-post, value for /pathname/some-post - noindex: false, - }, + list: { + pathname: 'blog', // blog main path, you can change this to "articles" (/articles) + noindex: false, + disabled: false, + }, - category: { - disabled: false, - pathname: 'category', // set empty to change from /category/some-category to /some-category - noindex: true, - }, + post: { + pathname: '', // empty for /some-post, value for /pathname/some-post + noindex: false, + disabled: false, + }, - tag: { - disabled: false, - pathname: 'tag', // set empty to change from /tag/some-tag to /some-tag - noindex: true, + category: { + pathname: 'category', // set empty to change from /category/some-category to /some-category + noindex: true, + disabled: false, + }, + + tag: { + pathname: 'tag', // set empty to change from /tag/some-tag to /some-tag + noindex: true, + disabled: false, + }, }, }; + +export const SITE = { ...CONFIG, blog: undefined }; +export const BLOG = CONFIG.blog; diff --git a/src/pages/[...blog]/[...page].astro b/src/pages/[...blog]/[...page].astro index 57043a2..858f9ca 100644 --- a/src/pages/[...blog]/[...page].astro +++ b/src/pages/[...blog]/[...page].astro @@ -10,7 +10,7 @@ import { BLOG_BASE } from '~/utils/permalinks'; import Title from '~/components/blog/Title.astro'; export async function getStaticPaths({ paginate }) { - if (BLOG?.disabled || BLOG?.blog?.disabled) return []; + if (BLOG?.disabled || BLOG?.list?.disabled) return []; return paginate(await fetchPosts(), { params: { blog: BLOG_BASE || undefined }, pageSize: BLOG.postsPerPage, @@ -23,7 +23,7 @@ const currentPage = page.currentPage ?? 1; const meta = { title: `Blog${currentPage > 1 ? ` — Page ${currentPage}` : ''}`, description: SITE.description, - noindex: BLOG?.blog?.noindex || currentPage > 1, + noindex: BLOG?.list?.noindex || currentPage > 1, ogType: 'blog', }; --- diff --git a/src/utils/permalinks.ts b/src/utils/permalinks.ts index 466a973..b209e70 100644 --- a/src/utils/permalinks.ts +++ b/src/utils/permalinks.ts @@ -24,7 +24,7 @@ export const cleanSlug = (text: string) => .map((slug) => slugify(slug)) .join('/'); -export const BLOG_BASE = cleanSlug(BLOG?.blog?.pathname); +export const BLOG_BASE = cleanSlug(BLOG?.list?.pathname); export const POST_BASE = cleanSlug(BLOG?.post?.pathname); export const CATEGORY_BASE = cleanSlug(BLOG?.category?.pathname); export const TAG_BASE = cleanSlug(BLOG?.tag?.pathname);