feat: Astro update
This commit is contained in:
parent
b40644e307
commit
a8c09361a9
8 changed files with 1405 additions and 1160 deletions
177
astro.config.mjs
177
astro.config.mjs
|
|
@ -4,6 +4,8 @@ import sitemap from "@astrojs/sitemap";
|
|||
import compressor from "astro-compressor";
|
||||
import starlight from "@astrojs/starlight";
|
||||
|
||||
import mdx from "@astrojs/mdx";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// https://docs.astro.build/en/guides/images/#authorizing-remote-images
|
||||
|
|
@ -22,102 +24,97 @@ export default defineConfig({
|
|||
// },
|
||||
// },
|
||||
prefetch: true,
|
||||
integrations: [
|
||||
tailwind(),
|
||||
sitemap({
|
||||
i18n: {
|
||||
defaultLocale: "en", // All urls that don't contain `fr` after `https://screwfast.uk/` will be treated as default locale, i.e. `en`
|
||||
locales: {
|
||||
en: "en", // The `defaultLocale` value must present in `locales` keys
|
||||
fr: "fr",
|
||||
},
|
||||
},
|
||||
}),
|
||||
starlight({
|
||||
title: "ScrewFast Docs",
|
||||
defaultLocale: "root",
|
||||
// https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md
|
||||
// If no Astro and Starlight i18n configurations are provided, the built-in default locale is used in Starlight and a matching Astro i18n configuration is generated/used.
|
||||
// If only a Starlight i18n configuration is provided, an equivalent Astro i18n configuration is generated/used.
|
||||
// If only an Astro i18n configuration is provided, the Starlight i18n configuration is updated to match it.
|
||||
// If both an Astro and Starlight i18n configurations are provided, an error is thrown.
|
||||
integrations: [tailwind(), sitemap({
|
||||
i18n: {
|
||||
defaultLocale: "en", // All urls that don't contain `fr` after `https://screwfast.uk/` will be treated as default locale, i.e. `en`
|
||||
locales: {
|
||||
root: {
|
||||
label: "English",
|
||||
lang: "en",
|
||||
},
|
||||
de: { label: "Deutsch", lang: "de" },
|
||||
es: { label: "Español", lang: "es" },
|
||||
fa: { label: "Persian", lang: "fa", dir: "rtl" },
|
||||
fr: { label: "Français", lang: "fr" },
|
||||
ja: { label: "日本語", lang: "ja" },
|
||||
"zh-cn": { label: "简体中文", lang: "zh-CN" },
|
||||
en: "en", // The `defaultLocale` value must present in `locales` keys
|
||||
fr: "fr",
|
||||
},
|
||||
// https://starlight.astro.build/guides/sidebar/
|
||||
sidebar: [
|
||||
{
|
||||
label: "Quick Start Guides",
|
||||
translations: {
|
||||
de: "Schnellstartanleitungen",
|
||||
es: "Guías de Inicio Rápido",
|
||||
fa: "راهنمای شروع سریع",
|
||||
fr: "Guides de Démarrage Rapide",
|
||||
ja: "クイックスタートガイド",
|
||||
"zh-cn": "快速入门指南",
|
||||
},
|
||||
autogenerate: { directory: "guides" },
|
||||
},
|
||||
{
|
||||
label: "Tools & Equipment",
|
||||
items: [
|
||||
{ label: "Tool Guides", link: "tools/tool-guides/" },
|
||||
{ label: "Equipment Care", link: "tools/equipment-care/" },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Construction Services",
|
||||
autogenerate: { directory: "construction" },
|
||||
},
|
||||
{
|
||||
label: "Advanced Topics",
|
||||
autogenerate: { directory: "advanced" },
|
||||
},
|
||||
],
|
||||
social: {
|
||||
github: "https://github.com/mearashadowfax/ScrewFast",
|
||||
},
|
||||
}), starlight({
|
||||
title: "ScrewFast Docs",
|
||||
defaultLocale: "root",
|
||||
// https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md
|
||||
// If no Astro and Starlight i18n configurations are provided, the built-in default locale is used in Starlight and a matching Astro i18n configuration is generated/used.
|
||||
// If only a Starlight i18n configuration is provided, an equivalent Astro i18n configuration is generated/used.
|
||||
// If only an Astro i18n configuration is provided, the Starlight i18n configuration is updated to match it.
|
||||
// If both an Astro and Starlight i18n configurations are provided, an error is thrown.
|
||||
locales: {
|
||||
root: {
|
||||
label: "English",
|
||||
lang: "en",
|
||||
},
|
||||
disable404Route: true,
|
||||
customCss: ["./src/assets/styles/starlight.css"],
|
||||
favicon: "/favicon.ico",
|
||||
components: {
|
||||
SiteTitle: "./src/components/ui/starlight/SiteTitle.astro",
|
||||
Head: "./src/components/ui/starlight/Head.astro",
|
||||
MobileMenuFooter: "./src/components/ui/starlight/MobileMenuFooter.astro",
|
||||
ThemeSelect: "./src/components/ui/starlight/ThemeSelect.astro",
|
||||
de: { label: "Deutsch", lang: "de" },
|
||||
es: { label: "Español", lang: "es" },
|
||||
fa: { label: "Persian", lang: "fa", dir: "rtl" },
|
||||
fr: { label: "Français", lang: "fr" },
|
||||
ja: { label: "日本語", lang: "ja" },
|
||||
"zh-cn": { label: "简体中文", lang: "zh-CN" },
|
||||
},
|
||||
// https://starlight.astro.build/guides/sidebar/
|
||||
sidebar: [
|
||||
{
|
||||
label: "Quick Start Guides",
|
||||
translations: {
|
||||
de: "Schnellstartanleitungen",
|
||||
es: "Guías de Inicio Rápido",
|
||||
fa: "راهنمای شروع سریع",
|
||||
fr: "Guides de Démarrage Rapide",
|
||||
ja: "クイックスタートガイド",
|
||||
"zh-cn": "快速入门指南",
|
||||
},
|
||||
autogenerate: { directory: "guides" },
|
||||
},
|
||||
head: [
|
||||
{
|
||||
tag: "meta",
|
||||
attrs: {
|
||||
property: "og:image",
|
||||
content: "https://screwfast.uk" + "/social.webp",
|
||||
},
|
||||
{
|
||||
label: "Tools & Equipment",
|
||||
items: [
|
||||
{ label: "Tool Guides", link: "tools/tool-guides/" },
|
||||
{ label: "Equipment Care", link: "tools/equipment-care/" },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Construction Services",
|
||||
autogenerate: { directory: "construction" },
|
||||
},
|
||||
{
|
||||
label: "Advanced Topics",
|
||||
autogenerate: { directory: "advanced" },
|
||||
},
|
||||
],
|
||||
social: {
|
||||
github: "https://github.com/mearashadowfax/ScrewFast",
|
||||
},
|
||||
disable404Route: true,
|
||||
customCss: ["./src/assets/styles/starlight.css"],
|
||||
favicon: "/favicon.ico",
|
||||
components: {
|
||||
SiteTitle: "./src/components/ui/starlight/SiteTitle.astro",
|
||||
Head: "./src/components/ui/starlight/Head.astro",
|
||||
MobileMenuFooter: "./src/components/ui/starlight/MobileMenuFooter.astro",
|
||||
ThemeSelect: "./src/components/ui/starlight/ThemeSelect.astro",
|
||||
},
|
||||
head: [
|
||||
{
|
||||
tag: "meta",
|
||||
attrs: {
|
||||
property: "og:image",
|
||||
content: "https://screwfast.uk" + "/social.webp",
|
||||
},
|
||||
{
|
||||
tag: "meta",
|
||||
attrs: {
|
||||
property: "twitter:image",
|
||||
content: "https://screwfast.uk" + "/social.webp",
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: "meta",
|
||||
attrs: {
|
||||
property: "twitter:image",
|
||||
content: "https://screwfast.uk" + "/social.webp",
|
||||
},
|
||||
],
|
||||
}),
|
||||
compressor({
|
||||
gzip: false,
|
||||
brotli: true,
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
}), compressor({
|
||||
gzip: false,
|
||||
brotli: true,
|
||||
}), mdx()],
|
||||
experimental: {
|
||||
clientPrerender: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
2092
package-lock.json
generated
2092
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -11,16 +11,17 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.9.4",
|
||||
"@astrojs/mdx": "^4.0.3",
|
||||
"@astrojs/sitemap": "^3.2.1",
|
||||
"@astrojs/starlight": "^0.29.3",
|
||||
"@astrojs/starlight-tailwind": "^2.0.3",
|
||||
"@astrojs/tailwind": "^5.1.3",
|
||||
"@astrojs/starlight": "^0.30.3",
|
||||
"@astrojs/starlight-tailwind": "^3.0.0",
|
||||
"@astrojs/tailwind": "^5.1.4",
|
||||
"@preline/accordion": "^2.5.0",
|
||||
"@preline/collapse": "^2.6.0",
|
||||
"@preline/dropdown": "^2.5.0",
|
||||
"@preline/overlay": "^2.6.0",
|
||||
"@preline/tabs": "^2.6.0",
|
||||
"astro": "^4.16.17",
|
||||
"astro": "^5.1.2",
|
||||
"astro-compressor": "^1.0.0",
|
||||
"clipboard": "^2.0.11",
|
||||
"globby": "^14.0.2",
|
||||
|
|
|
|||
97
src/content.config.ts
Normal file
97
src/content.config.ts
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// https://docs.astro.build/en/guides/content-collections/#defining-collections
|
||||
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
import { docsSchema } from '@astrojs/starlight/schema';
|
||||
import { glob } from 'astro/loaders';
|
||||
|
||||
const productsCollection = defineCollection({
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/products" }),
|
||||
schema: ({ image }) => z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
main: z.object({
|
||||
id: z.number(),
|
||||
content: z.string(),
|
||||
imgCard: image(),
|
||||
imgMain: image(),
|
||||
imgAlt: z.string(),
|
||||
}),
|
||||
tabs: z.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
dataTab: z.string(),
|
||||
title: z.string(),
|
||||
})
|
||||
),
|
||||
longDescription: z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
btnTitle: z.string(),
|
||||
btnURL: z.string(),
|
||||
}),
|
||||
descriptionList: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
),
|
||||
specificationsLeft: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
),
|
||||
specificationsRight: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
).optional(),
|
||||
tableData: z.array(
|
||||
z.object({
|
||||
feature: z.array(z.string()),
|
||||
description: z.array(z.array(z.string())),
|
||||
})
|
||||
).optional(),
|
||||
blueprints: z.object({
|
||||
first: image().optional(),
|
||||
second: image().optional(),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
const blogCollection = defineCollection({
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/blog" }),
|
||||
schema: ({ image }) => z.object ({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
contents: z.array(z.string()),
|
||||
author: z.string(),
|
||||
role: z.string().optional(),
|
||||
authorImage: image(),
|
||||
authorImageAlt: z.string(),
|
||||
pubDate: z.date(),
|
||||
cardImage: image(),
|
||||
cardImageAlt: z.string(),
|
||||
readTime: z.number(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const insightsCollection = defineCollection({
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/insights" }),
|
||||
schema: ({ image }) => z.object ({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
// contents: z.array(z.string()),
|
||||
cardImage: image(),
|
||||
cardImageAlt: z.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
docs: defineCollection({ schema: docsSchema() }),
|
||||
'products': productsCollection,
|
||||
'blog': blogCollection,
|
||||
'insights': insightsCollection,
|
||||
};
|
||||
|
|
@ -1,96 +1,96 @@
|
|||
// https://docs.astro.build/en/guides/content-collections/#defining-collections
|
||||
// // https://docs.astro.build/en/guides/content-collections/#defining-collections
|
||||
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
import { docsSchema } from '@astrojs/starlight/schema';
|
||||
// import { z, defineCollection } from 'astro:content';
|
||||
// import { docsSchema } from '@astrojs/starlight/schema';
|
||||
|
||||
const productsCollection = defineCollection({
|
||||
type: 'content',
|
||||
schema: ({ image }) => z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
main: z.object({
|
||||
id: z.number(),
|
||||
content: z.string(),
|
||||
imgCard: image(),
|
||||
imgMain: image(),
|
||||
imgAlt: z.string(),
|
||||
}),
|
||||
tabs: z.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
dataTab: z.string(),
|
||||
title: z.string(),
|
||||
})
|
||||
),
|
||||
longDescription: z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
btnTitle: z.string(),
|
||||
btnURL: z.string(),
|
||||
}),
|
||||
descriptionList: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
),
|
||||
specificationsLeft: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
),
|
||||
specificationsRight: z.array(
|
||||
z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
})
|
||||
).optional(),
|
||||
tableData: z.array(
|
||||
z.object({
|
||||
feature: z.array(z.string()),
|
||||
description: z.array(z.array(z.string())),
|
||||
})
|
||||
).optional(),
|
||||
blueprints: z.object({
|
||||
first: image().optional(),
|
||||
second: image().optional(),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
// const productsCollection = defineCollection({
|
||||
// type: 'content',
|
||||
// schema: ({ image }) => z.object({
|
||||
// title: z.string(),
|
||||
// description: z.string(),
|
||||
// main: z.object({
|
||||
// id: z.number(),
|
||||
// content: z.string(),
|
||||
// imgCard: image(),
|
||||
// imgMain: image(),
|
||||
// imgAlt: z.string(),
|
||||
// }),
|
||||
// tabs: z.array(
|
||||
// z.object({
|
||||
// id: z.string(),
|
||||
// dataTab: z.string(),
|
||||
// title: z.string(),
|
||||
// })
|
||||
// ),
|
||||
// longDescription: z.object({
|
||||
// title: z.string(),
|
||||
// subTitle: z.string(),
|
||||
// btnTitle: z.string(),
|
||||
// btnURL: z.string(),
|
||||
// }),
|
||||
// descriptionList: z.array(
|
||||
// z.object({
|
||||
// title: z.string(),
|
||||
// subTitle: z.string(),
|
||||
// })
|
||||
// ),
|
||||
// specificationsLeft: z.array(
|
||||
// z.object({
|
||||
// title: z.string(),
|
||||
// subTitle: z.string(),
|
||||
// })
|
||||
// ),
|
||||
// specificationsRight: z.array(
|
||||
// z.object({
|
||||
// title: z.string(),
|
||||
// subTitle: z.string(),
|
||||
// })
|
||||
// ).optional(),
|
||||
// tableData: z.array(
|
||||
// z.object({
|
||||
// feature: z.array(z.string()),
|
||||
// description: z.array(z.array(z.string())),
|
||||
// })
|
||||
// ).optional(),
|
||||
// blueprints: z.object({
|
||||
// first: image().optional(),
|
||||
// second: image().optional(),
|
||||
// }),
|
||||
// }),
|
||||
// });
|
||||
|
||||
const blogCollection = defineCollection({
|
||||
type: "content",
|
||||
schema: ({ image }) => z.object ({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
contents: z.array(z.string()),
|
||||
author: z.string(),
|
||||
role: z.string().optional(),
|
||||
authorImage: image(),
|
||||
authorImageAlt: z.string(),
|
||||
pubDate: z.date(),
|
||||
cardImage: image(),
|
||||
cardImageAlt: z.string(),
|
||||
readTime: z.number(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
}),
|
||||
});
|
||||
// const blogCollection = defineCollection({
|
||||
// type: "content",
|
||||
// schema: ({ image }) => z.object ({
|
||||
// title: z.string(),
|
||||
// description: z.string(),
|
||||
// contents: z.array(z.string()),
|
||||
// author: z.string(),
|
||||
// role: z.string().optional(),
|
||||
// authorImage: image(),
|
||||
// authorImageAlt: z.string(),
|
||||
// pubDate: z.date(),
|
||||
// cardImage: image(),
|
||||
// cardImageAlt: z.string(),
|
||||
// readTime: z.number(),
|
||||
// tags: z.array(z.string()).optional(),
|
||||
// }),
|
||||
// });
|
||||
|
||||
const insightsCollection = defineCollection({
|
||||
type: "content",
|
||||
schema: ({ image }) => z.object ({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
// contents: z.array(z.string()),
|
||||
cardImage: image(),
|
||||
cardImageAlt: z.string(),
|
||||
}),
|
||||
});
|
||||
// const insightsCollection = defineCollection({
|
||||
// type: "content",
|
||||
// schema: ({ image }) => z.object ({
|
||||
// title: z.string(),
|
||||
// description: z.string(),
|
||||
// // contents: z.array(z.string()),
|
||||
// cardImage: image(),
|
||||
// cardImageAlt: z.string(),
|
||||
// }),
|
||||
// });
|
||||
|
||||
export const collections = {
|
||||
docs: defineCollection({ schema: docsSchema() }),
|
||||
'products': productsCollection,
|
||||
'blog': blogCollection,
|
||||
'insights': insightsCollection,
|
||||
};
|
||||
// export const collections = {
|
||||
// docs: defineCollection({ schema: docsSchema() }),
|
||||
// 'products': productsCollection,
|
||||
// 'blog': blogCollection,
|
||||
// 'insights': insightsCollection,
|
||||
// };
|
||||
|
|
@ -54,7 +54,7 @@ const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-pretty text-sm font-light text-neutral-500">
|
||||
<p class="text-pretty text-sm text-neutral-500">
|
||||
Table of Contents:
|
||||
</p>
|
||||
<div id="toc" class="">
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-pretty text-sm font-light text-neutral-500">
|
||||
<p class="text-pretty text-sm text-neutral-500">
|
||||
Table of Contents:
|
||||
</p>
|
||||
<div id="toc" class="">
|
||||
|
|
|
|||
|
|
@ -12,5 +12,7 @@
|
|||
"@styles/*": ["src/assets/styles/*"],
|
||||
"@utils/*": ["src/utils/*"]
|
||||
},
|
||||
}
|
||||
},
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue