Use Prettier
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
---
|
||||
import Layout from "~/layouts/BaseLayout.astro";
|
||||
import { SITE } from "~/config.mjs";
|
||||
import Error404 from "~/components/widgets/Error404.astro";
|
||||
import Layout from '~/layouts/BaseLayout.astro';
|
||||
import { SITE } from '~/config.mjs';
|
||||
import Error404 from '~/components/widgets/Error404.astro';
|
||||
|
||||
const title = `Error 404 — ${SITE.name}`;
|
||||
---
|
||||
|
||||
<Layout meta={{ title }}>
|
||||
<Error404 />
|
||||
<Error404 />
|
||||
</Layout>
|
||||
|
@ -1,39 +1,39 @@
|
||||
---
|
||||
import { SITE, BLOG } from "~/config.mjs";
|
||||
import { SITE, BLOG } from '~/config.mjs';
|
||||
|
||||
import Layout from "~/layouts/BlogLayout.astro";
|
||||
import BlogList from "~/components/blog/List.astro";
|
||||
import Pagination from "~/components/atoms/Pagination.astro";
|
||||
import Layout from '~/layouts/BlogLayout.astro';
|
||||
import BlogList from '~/components/blog/List.astro';
|
||||
import Pagination from '~/components/atoms/Pagination.astro';
|
||||
|
||||
import { fetchPosts } from "~/utils/posts";
|
||||
import { getCanonical, getPermalink, BLOG_BASE } from "~/utils/permalinks";
|
||||
import { fetchPosts } from '~/utils/posts';
|
||||
import { getCanonical, getPermalink, BLOG_BASE } from '~/utils/permalinks';
|
||||
|
||||
export async function getStaticPaths({ paginate }) {
|
||||
if (BLOG?.disabled) return [];
|
||||
if (BLOG?.disabled) return [];
|
||||
|
||||
const posts = await fetchPosts();
|
||||
const posts = await fetchPosts();
|
||||
|
||||
return paginate(posts, {
|
||||
params: { blog: BLOG_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
});
|
||||
return paginate(posts, {
|
||||
params: { blog: BLOG_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
});
|
||||
}
|
||||
|
||||
const { page } = Astro.props;
|
||||
const currentPage = page.currentPage ?? 1;
|
||||
|
||||
const meta = {
|
||||
title: `Blog ${currentPage > 1 ? `— Page ${currentPage} ` : ""}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
title: `Blog ${currentPage > 1 ? `— Page ${currentPage} ` : ''}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
};
|
||||
---
|
||||
|
||||
<Layout meta={meta}>
|
||||
<Fragment slot="title">
|
||||
News and step-by-step guides about
|
||||
<span class="bg-clip-text text-transparent bg-gradient-to-r from-primary-500 to-secondary-500">AstroWind</span>
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
<Layout {meta}>
|
||||
<Fragment slot="title">
|
||||
News and step-by-step guides about
|
||||
<span class="bg-clip-text text-transparent bg-gradient-to-r from-primary-500 to-secondary-500">AstroWind</span>
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
</Layout>
|
||||
|
@ -1,34 +1,37 @@
|
||||
---
|
||||
import { SITE, BLOG } from "~/config.mjs";
|
||||
import { SITE, BLOG } from '~/config.mjs';
|
||||
|
||||
import Layout from "~/layouts/PageLayout.astro";
|
||||
import SinglePost from "~/components/blog/SinglePost.astro";
|
||||
import Layout from '~/layouts/PageLayout.astro';
|
||||
import SinglePost from '~/components/blog/SinglePost.astro';
|
||||
|
||||
import { getCanonical, getPermalink, cleanSlug, BLOG_BASE } from "~/utils/permalinks";
|
||||
import { fetchPosts } from "~/utils/posts";
|
||||
import { findImage } from "~/utils/images";
|
||||
import { getCanonical, getPermalink, cleanSlug, BLOG_BASE } from '~/utils/permalinks';
|
||||
import { fetchPosts } from '~/utils/posts';
|
||||
import { findImage } from '~/utils/images';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
if (BLOG?.disabled) return [];
|
||||
if (BLOG?.disabled) return [];
|
||||
|
||||
const posts = await fetchPosts();
|
||||
const posts = await fetchPosts();
|
||||
|
||||
return posts.map((post) => ({
|
||||
params: { slug: cleanSlug(post.slug), blog: BLOG.postsWithoutBlogSlug ? undefined : BLOG_BASE || undefined },
|
||||
props: { post },
|
||||
}));
|
||||
return posts.map((post) => ({
|
||||
params: {
|
||||
slug: cleanSlug(post.slug),
|
||||
blog: BLOG.postsWithoutBlogSlug ? undefined : BLOG_BASE || undefined,
|
||||
},
|
||||
props: { post },
|
||||
}));
|
||||
}
|
||||
|
||||
const { post } = Astro.props;
|
||||
|
||||
const meta = {
|
||||
title: `${post.title} — ${SITE.name}`,
|
||||
description: post.description,
|
||||
canonical: post.canonical || getCanonical(getPermalink(post.slug, "post")),
|
||||
image: await findImage(post.image),
|
||||
title: `${post.title} — ${SITE.name}`,
|
||||
description: post.description,
|
||||
canonical: post.canonical || getCanonical(getPermalink(post.slug, 'post')),
|
||||
image: await findImage(post.image),
|
||||
};
|
||||
---
|
||||
|
||||
<Layout meta={meta}>
|
||||
<SinglePost post={{ ...post, image: meta.image }} />
|
||||
<Layout {meta}>
|
||||
<SinglePost post={{ ...post, image: meta.image }} />
|
||||
</Layout>
|
||||
|
@ -1,33 +1,33 @@
|
||||
---
|
||||
import { SITE, BLOG } from "~/config.mjs";
|
||||
import { SITE, BLOG } from '~/config.mjs';
|
||||
|
||||
import Layout from "~/layouts/BlogLayout.astro";
|
||||
import BlogList from "~/components/blog/List.astro";
|
||||
import Pagination from "~/components/atoms/Pagination.astro";
|
||||
import Layout from '~/layouts/BlogLayout.astro';
|
||||
import BlogList from '~/components/blog/List.astro';
|
||||
import Pagination from '~/components/atoms/Pagination.astro';
|
||||
|
||||
import { fetchPosts } from "~/utils/posts";
|
||||
import { getCanonical, getPermalink, cleanSlug, CATEGORY_BASE } from "~/utils/permalinks";
|
||||
import { fetchPosts } from '~/utils/posts';
|
||||
import { getCanonical, getPermalink, cleanSlug, CATEGORY_BASE } from '~/utils/permalinks';
|
||||
|
||||
export async function getStaticPaths({ paginate }) {
|
||||
if (BLOG?.disabled || BLOG?.category?.disabled) return [];
|
||||
if (BLOG?.disabled || BLOG?.category?.disabled) return [];
|
||||
|
||||
const posts = await fetchPosts();
|
||||
const posts = await fetchPosts();
|
||||
|
||||
const categories = new Set();
|
||||
posts.map((post) => {
|
||||
typeof post.category === "string" && categories.add(post.category.toLowerCase());
|
||||
});
|
||||
const categories = new Set();
|
||||
posts.map((post) => {
|
||||
typeof post.category === 'string' && categories.add(post.category.toLowerCase());
|
||||
});
|
||||
|
||||
return Array.from(categories).map((category) =>
|
||||
paginate(
|
||||
posts.filter((post) => typeof post.category === "string" && category === post.category.toLowerCase()),
|
||||
{
|
||||
params: { category: cleanSlug(category), categories: CATEGORY_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
props: { category },
|
||||
}
|
||||
)
|
||||
);
|
||||
return Array.from(categories).map((category) =>
|
||||
paginate(
|
||||
posts.filter((post) => typeof post.category === 'string' && category === post.category.toLowerCase()),
|
||||
{
|
||||
params: { category: cleanSlug(category), categories: CATEGORY_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
props: { category },
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const { page, category } = Astro.props;
|
||||
@ -35,16 +35,16 @@ const { page, category } = Astro.props;
|
||||
const currentPage = page.currentPage ?? 1;
|
||||
|
||||
const meta = {
|
||||
title: `Category '${category}' ${currentPage > 1 ? `— Page ${currentPage} ` : ""}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
title: `Category '${category}' ${currentPage > 1 ? `— Page ${currentPage} ` : ''}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
};
|
||||
---
|
||||
|
||||
<Layout meta={{ ...meta, noindex: true }}>
|
||||
<Fragment slot="title">
|
||||
Category: {category}
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
<Fragment slot="title">
|
||||
Category: {category}
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
</Layout>
|
||||
|
@ -1,33 +1,33 @@
|
||||
---
|
||||
import { SITE, BLOG } from "~/config.mjs";
|
||||
import { SITE, BLOG } from '~/config.mjs';
|
||||
|
||||
import Layout from "~/layouts/BlogLayout.astro";
|
||||
import BlogList from "~/components/blog/List.astro";
|
||||
import Pagination from "~/components/atoms/Pagination.astro";
|
||||
import Layout from '~/layouts/BlogLayout.astro';
|
||||
import BlogList from '~/components/blog/List.astro';
|
||||
import Pagination from '~/components/atoms/Pagination.astro';
|
||||
|
||||
import { fetchPosts } from "~/utils/posts";
|
||||
import { getCanonical, getPermalink, cleanSlug, TAG_BASE } from "~/utils/permalinks";
|
||||
import { fetchPosts } from '~/utils/posts';
|
||||
import { getCanonical, getPermalink, cleanSlug, TAG_BASE } from '~/utils/permalinks';
|
||||
|
||||
export async function getStaticPaths({ paginate }) {
|
||||
if (BLOG?.disabled || BLOG?.tag?.disabled) return [];
|
||||
if (BLOG?.disabled || BLOG?.tag?.disabled) return [];
|
||||
|
||||
const posts = await fetchPosts();
|
||||
const posts = await fetchPosts();
|
||||
|
||||
const tags = new Set();
|
||||
posts.map((post) => {
|
||||
Array.isArray(post.tags) && post.tags.map((tag) => tags.add(tag.toLowerCase()));
|
||||
});
|
||||
const tags = new Set();
|
||||
posts.map((post) => {
|
||||
Array.isArray(post.tags) && post.tags.map((tag) => tags.add(tag.toLowerCase()));
|
||||
});
|
||||
|
||||
return Array.from(tags).map((tag) =>
|
||||
paginate(
|
||||
posts.filter((post) => Array.isArray(post.tags) && post.tags.includes(tag)),
|
||||
{
|
||||
params: { tag: cleanSlug(tag), tags: TAG_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
props: { tag },
|
||||
}
|
||||
)
|
||||
);
|
||||
return Array.from(tags).map((tag) =>
|
||||
paginate(
|
||||
posts.filter((post) => Array.isArray(post.tags) && post.tags.includes(tag)),
|
||||
{
|
||||
params: { tag: cleanSlug(tag), tags: TAG_BASE || undefined },
|
||||
pageSize: BLOG.postsPerPage,
|
||||
props: { tag },
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const { page, tag } = Astro.props;
|
||||
@ -35,16 +35,16 @@ const { page, tag } = Astro.props;
|
||||
const currentPage = page.currentPage ?? 1;
|
||||
|
||||
const meta = {
|
||||
title: `Posts by tag '${tag}' ${currentPage > 1 ? `— Page ${currentPage} ` : ""}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
title: `Posts by tag '${tag}' ${currentPage > 1 ? `— Page ${currentPage} ` : ''}— ${SITE.name}`,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getPermalink(page.url.current)),
|
||||
};
|
||||
---
|
||||
|
||||
<Layout meta={{ ...meta, noindex: true }}>
|
||||
<Fragment slot="title">
|
||||
Tag: {tag}
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
<Fragment slot="title">
|
||||
Tag: {tag}
|
||||
</Fragment>
|
||||
<BlogList posts={page.data} />
|
||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||
</Layout>
|
||||
|
@ -1,33 +1,33 @@
|
||||
---
|
||||
import { SITE } from "~/config.mjs";
|
||||
import { getCanonical, getHomePermalink } from "~/utils/permalinks";
|
||||
import Layout from "~/layouts/PageLayout.astro";
|
||||
import { SITE } from '~/config.mjs';
|
||||
import { getCanonical, getHomePermalink } from '~/utils/permalinks';
|
||||
import Layout from '~/layouts/PageLayout.astro';
|
||||
|
||||
import Hero from "~/components/widgets/Hero.astro";
|
||||
import Features from "~/components/widgets/Features.astro";
|
||||
import Features2 from "~/components/widgets/Features2.astro";
|
||||
import Steps from "~/components/widgets/Steps.astro";
|
||||
import Features3 from "~/components/widgets/Features3.astro";
|
||||
import HighlightedPosts from "~/components/blog/HighlightedPosts.astro";
|
||||
import FAQs from "~/components/widgets/FAQs.astro";
|
||||
import Stats from "~/components/widgets/Stats.astro";
|
||||
import CallToAction from "~/components/widgets/CallToAction.astro";
|
||||
import Hero from '~/components/widgets/Hero.astro';
|
||||
import Features from '~/components/widgets/Features.astro';
|
||||
import Features2 from '~/components/widgets/Features2.astro';
|
||||
import Steps from '~/components/widgets/Steps.astro';
|
||||
import Features3 from '~/components/widgets/Features3.astro';
|
||||
import HighlightedPosts from '~/components/blog/HighlightedPosts.astro';
|
||||
import FAQs from '~/components/widgets/FAQs.astro';
|
||||
import Stats from '~/components/widgets/Stats.astro';
|
||||
import CallToAction from '~/components/widgets/CallToAction.astro';
|
||||
|
||||
const meta = {
|
||||
title: SITE.title,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getHomePermalink()),
|
||||
title: SITE.title,
|
||||
description: SITE.description,
|
||||
canonical: getCanonical(getHomePermalink()),
|
||||
};
|
||||
---
|
||||
|
||||
<Layout meta={meta}>
|
||||
<Hero />
|
||||
<Features />
|
||||
<Steps />
|
||||
<Features2 />
|
||||
<Features3 />
|
||||
<HighlightedPosts />
|
||||
<FAQs />
|
||||
<Stats />
|
||||
<CallToAction />
|
||||
<Layout {meta}>
|
||||
<Hero />
|
||||
<Features />
|
||||
<Steps />
|
||||
<Features2 />
|
||||
<Features3 />
|
||||
<HighlightedPosts />
|
||||
<FAQs />
|
||||
<Stats />
|
||||
<CallToAction />
|
||||
</Layout>
|
||||
|
@ -1,29 +1,29 @@
|
||||
import rss from "@astrojs/rss";
|
||||
import rss from '@astrojs/rss';
|
||||
|
||||
import { SITE, BLOG } from "~/config.mjs";
|
||||
import { fetchPosts } from "~/utils/posts";
|
||||
import { getPermalink } from "~/utils/permalinks";
|
||||
import { SITE, BLOG } from '~/config.mjs';
|
||||
import { fetchPosts } from '~/utils/posts';
|
||||
import { getPermalink } from '~/utils/permalinks';
|
||||
|
||||
export const get = async () => {
|
||||
if (BLOG.disabled) {
|
||||
return new Response(null, {
|
||||
status: 404,
|
||||
statusText: 'Not found'
|
||||
});
|
||||
}
|
||||
if (BLOG.disabled) {
|
||||
return new Response(null, {
|
||||
status: 404,
|
||||
statusText: 'Not found',
|
||||
});
|
||||
}
|
||||
|
||||
const posts = await fetchPosts();
|
||||
const posts = await fetchPosts();
|
||||
|
||||
return rss({
|
||||
title: `${SITE.name}’s Blog`,
|
||||
description: SITE.description,
|
||||
site: import.meta.env.SITE,
|
||||
return rss({
|
||||
title: `${SITE.name}’s Blog`,
|
||||
description: SITE.description,
|
||||
site: import.meta.env.SITE,
|
||||
|
||||
items: posts.map((post) => ({
|
||||
link: getPermalink(post.slug, "post"),
|
||||
title: post.title,
|
||||
description: post.description,
|
||||
pubDate: post.pubDate,
|
||||
})),
|
||||
});
|
||||
}
|
||||
items: posts.map((post) => ({
|
||||
link: getPermalink(post.slug, 'post'),
|
||||
title: post.title,
|
||||
description: post.description,
|
||||
pubDate: post.pubDate,
|
||||
})),
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user