Add variables to config and minimal refactor

This commit is contained in:
prototypa
2022-08-28 20:31:06 -04:00
parent 06bf8df636
commit 19b4a25012
9 changed files with 33 additions and 35 deletions

View File

@ -2,6 +2,8 @@
import { getImage } from "@astrojs/image";
import { getRelativeUrlByFilePath } from "~/utils/getRelativeUrlByFilePath";
import { SITE } from "~/config.mjs";
const { src: defaultImage } = await getImage({
src: import("~/assets/images/default.png"),
width: 1200,
@ -9,7 +11,7 @@ const { src: defaultImage } = await getImage({
});
const {
title = "AstroWind",
title = SITE.name,
description = "",
image: _image = defaultImage,
canonical,
@ -60,4 +62,4 @@ const image =
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
<!-- Google Site Verification -->
<meta name="google-site-verification" content="orcPxI47GSa-cRvY11tUe6iGg2IO_RPvnA1q95iEM3M" />
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}

View File

@ -1,9 +1,12 @@
export const SITE = {
name: "AstroWind",
domain: "https://astrowind.vercel.app",
github: "https://github.com/onwidget/astrowind",
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.",
postsPerPage: 6,
googleAnalyticsId: false, // or "G-XXXXXXXXXX"
googleAnalyticsId: false, // or "G-XXXXXXXXXX",
googleSiteVerificationId: "orcPxI47GSa-cRvY11tUe6iGg2IO_RPvnA1q95iEM3M",
};

View File

@ -16,7 +16,8 @@ const { googleAnalyticsId = false } = SITE;
<head>
<MetaTags {...meta} />
{googleAnalyticsId && <Analytics id={googleAnalyticsId} />}
{googleAnalyticsId &&
<Analytics id={googleAnalyticsId} />}
</head>
<body class="antialiased text-gray-900 dark:text-slate-300 tracking-tight bg-white dark:bg-slate-900">
@ -24,4 +25,4 @@ const { googleAnalyticsId = false } = SITE;
<BasicScripts />
</body>
</html>
</html>

View File

@ -9,6 +9,8 @@ const { meta } = Astro.props;
<Layout meta={meta}>
<Header />
<slot />
<main>
<slot />
</main>
<Footer />
</Layout>

View File

@ -7,7 +7,5 @@ const title = `Error 404 — ${SITE.name}`;
---
<Layout meta={{ title }}>
<main>
<Error404 />
</main>
<Error404 />
</Layout>

View File

@ -18,14 +18,11 @@ const { page } = Astro.props;
const currentPage = page.currentPage ?? 1;
const title = `Blog ${currentPage > 1 ? `— Page ${currentPage} ` : ""}— ${SITE.name
}`;
const description = "News and step-by-step guides about AstroWind";
const title = `Blog ${currentPage > 1 ? `— Page ${currentPage} ` : ""}— ${SITE.name}`;
const description = SITE.description;
const canonical = new URL(page.url.current, Astro.site);
---
<Layout meta={{ title, description, canonical }}>
<main>
<BlogList page={page} />
</main>
<BlogList page={page} />
</Layout>

View File

@ -25,7 +25,5 @@ const image = await findImage(post.image);
---
<Layout meta={{ title, description, canonical, image, }}>
<main>
<BlogPost post={{ ...post, image }} />
</main>
<BlogPost post={{ ...post, image }} />
</Layout>

View File

@ -13,22 +13,19 @@ import StepsLeft from "~/components/widgets/StepsLeft.astro";
import HighlightedPosts from "~/components/widgets/HighlightedPosts.astro";
import Stats from "~/components/widgets/Stats.astro";
const title = `${SITE.name} — Your website with Astro + Tailwind CSS`;
const description =
"🚀 AstroWind is a free and Ready to Start template to make your website using Astro and Tailwind CSS.";
const title = SITE.title;
const description = SITE.description;
const canonical = new URL("", Astro.site);
---
<Layout meta={{ title, description, canonical }}>
<main>
<Hero />
<BasicFeatures />
<StepsLeft />
<TwoColsFeatures />
<StepsFeatures />
<HighlightedPosts />
<FAQs />
<Stats />
<BasicCTA />
</main>
<Hero />
<BasicFeatures />
<StepsLeft />
<TwoColsFeatures />
<StepsFeatures />
<HighlightedPosts />
<FAQs />
<Stats />
<BasicCTA />
</Layout>

View File

@ -8,9 +8,9 @@ const posts = await fetchPosts();
export const get = () =>
rss({
title: `${SITE.name}s Blog`,
description:
"A ready to start template to make your website using Astro and Tailwind CSS.",
description: SITE.description,
site: import.meta.env.SITE,
items: posts.map((post) => ({
link: `blog/${post.slug}`,
title: post.title,