Rename product subtitles and adjust schema in collections
Redesigned the product markdown files and schema to divide product title and subtitle into separate 'title' and 'description' fields to provide better data representation. Adjusted CardWide and CardSmall components to accommodate these changes, ensuring consistent and appropriate depiction of product descriptions across all pages.
This commit is contained in:
parent
084fb32ab5
commit
87c23ca26e
9 changed files with 132 additions and 24 deletions
|
|
@ -36,6 +36,6 @@ const imageClass =
|
|||
<!-- The product's subtitle and the anchor SVG icon-->
|
||||
<span
|
||||
class="relative mb-3 ml-4 inline-block text-sm font-bold text-neutral-50 transition duration-[600ms] ease-[cubic-bezier(0.45,0,0.55,1)] group-hover:scale-110 md:ml-5 md:text-lg"
|
||||
>{product.data.main.subTitle} <Icon name="openInNew" />
|
||||
>{product.data.description} <Icon name="openInNew" />
|
||||
</span>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ const imageClass =
|
|||
<!-- This container includes product's subtitle and an SVG icon-->
|
||||
<span
|
||||
class="relative mb-3 ml-4 inline-block text-sm font-bold text-neutral-50 transition duration-[600ms] ease-[cubic-bezier(0.45,0,0.55,1)] group-hover:scale-110 md:ml-5 md:text-lg"
|
||||
>{product.data.main.subTitle} <Icon name="openInNew" /></span
|
||||
>{product.data.description} <Icon name="openInNew" /></span
|
||||
>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ 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(),
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
content: z.string(),
|
||||
imgCard: image(),
|
||||
imgMain: image(),
|
||||
|
|
@ -22,7 +22,7 @@ const productsCollection = defineCollection({
|
|||
title: z.string(),
|
||||
})
|
||||
),
|
||||
description: z.object({
|
||||
longDescription: z.object({
|
||||
title: z.string(),
|
||||
subTitle: z.string(),
|
||||
btnTitle: z.string(),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: "SF-AB A765"
|
||||
description: "Assorted Screw Set"
|
||||
main:
|
||||
id: 2
|
||||
title: "SF-AB A765"
|
||||
subTitle: "Assorted Screw Set"
|
||||
content: |
|
||||
Introducing the SF-AB A765 Assorted Screw Set – the ultimate solution for your screw fastening needs. This comprehensive set includes a wide variety of screws meticulously curated to tackle various projects with ease and precision.
|
||||
imgCard: "@/images/product-image-2.avif"
|
||||
|
|
@ -18,7 +18,7 @@ tabs:
|
|||
- id: "tabs-with-card-item-3"
|
||||
dataTab: "#tabs-with-card-3"
|
||||
title: "Blueprints"
|
||||
description:
|
||||
longDescription:
|
||||
title: "Versatile Screw Fastening Solutions"
|
||||
subTitle: |
|
||||
The SF-AB A765 Assorted Screw Set offers unmatched versatility and convenience, making it the perfect choice for DIY enthusiasts and professionals alike. With a comprehensive selection of screws, you'll always have the right fastener for the job.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: "SF-BN B203"
|
||||
description: "Tap Bolts and Nuts Set"
|
||||
main:
|
||||
id: 3
|
||||
title: "SF-BN B203"
|
||||
subTitle: "Tap Bolts and Nuts Set"
|
||||
content: |
|
||||
Meet the SF-BN B203 – your reliable companion for professional-grade fastening. This comprehensive box set comes with a versatile selection of tap bolts and nuts, meticulously crafted to provide the strongest hold for your construction and assembly projects.
|
||||
imgCard: "@/images/product-image-3.avif"
|
||||
|
|
@ -18,7 +18,7 @@ tabs:
|
|||
- id: "tabs-with-card-item-3"
|
||||
dataTab: "#tabs-with-card-3"
|
||||
title: "Blueprints"
|
||||
description:
|
||||
longDescription:
|
||||
title: "Strength Meets Precision"
|
||||
subTitle: |
|
||||
The SF-BN B203 Tap Bolts and Nuts Set offers robust durability and precision for construction professionals, ensuring reliable performance in every application, from house framing to machinery assembly.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: "SF-FN F303"
|
||||
description: "Hex Bolts"
|
||||
main:
|
||||
id: 4
|
||||
title: "SF-FN F303"
|
||||
subTitle: "Hex Bolts"
|
||||
content: |
|
||||
Introducing the SF-FN F303 Hex Bolts – the perfect choice for heavy-duty fastening applications. Crafted with precision and durability in mind, these hex bolts provide the strength and reliability you need for your toughest projects.
|
||||
imgCard: "@/images/product-image-4.avif"
|
||||
|
|
@ -18,7 +18,7 @@ tabs:
|
|||
- id: "tabs-with-card-item-3"
|
||||
dataTab: "#tabs-with-card-3"
|
||||
title: "Blueprints"
|
||||
description:
|
||||
longDescription:
|
||||
title: "Heavy-Duty Fastening Solutions"
|
||||
subTitle: |
|
||||
The SF-FN F303 Hex Bolts are designed to handle the toughest fastening challenges with ease. Whether you're working on construction projects or heavy machinery, these hex bolts deliver the strength and reliability you need.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: "SF-TB T845"
|
||||
description: "Machine Screws"
|
||||
main:
|
||||
id: 1
|
||||
title: "SF-TB T845"
|
||||
subTitle: "Machine Screws"
|
||||
content: |
|
||||
Introducing the SF-TB T845 – your go-to solution for precision fastening in machinery and equipment. This comprehensive set of machine screws is meticulously crafted to meet the stringent demands of industrial applications, ensuring secure and reliable fastening.
|
||||
imgCard: "@/images/product-image-1.avif"
|
||||
|
|
@ -18,7 +18,7 @@ tabs:
|
|||
- id: "tabs-with-card-item-3"
|
||||
dataTab: "#tabs-with-card-3"
|
||||
title: "Blueprints"
|
||||
description:
|
||||
longDescription:
|
||||
title: "Precision Fastening Solutions"
|
||||
subTitle: |
|
||||
The SF-TB T845 Machine Screws offer unparalleled precision and reliability for industrial applications, ensuring seamless operation and longevity for your machinery and equipment.
|
||||
|
|
|
|||
108
src/pages/fr/blog/index.astro
Normal file
108
src/pages/fr/blog/index.astro
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
// Import necessary components, modules and types
|
||||
import MainLayout from "@/layouts/MainLayout.astro";
|
||||
import CardBlog from "@/components/ui/cards/CardBlog.astro";
|
||||
import CardBlogRecent from "@/components/ui/cards/CardBlogRecent.astro";
|
||||
import CardInsight from "@/components/ui/cards/CardInsight.astro";
|
||||
import { getCollection } from "astro:content";
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import { SITE } from "@/data_files/constants";
|
||||
|
||||
// Get all blogs post and sort them based on publish date
|
||||
const blogPosts: CollectionEntry<"blog">[] = (await getCollection("blog")).sort(
|
||||
(a: CollectionEntry<"blog">, b: CollectionEntry<"blog">) =>
|
||||
b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||
);
|
||||
// Get all insights posts
|
||||
const insightPosts: CollectionEntry<"insights">[] =
|
||||
await getCollection("insights");
|
||||
|
||||
// Separate the most recent post from others
|
||||
const mostRecentPost: CollectionEntry<"blog"> = blogPosts[0];
|
||||
const otherPosts: CollectionEntry<"blog">[] = blogPosts.slice(1);
|
||||
|
||||
// Define variables for page content
|
||||
const title: string = "Your Gateway to Construction Excellence";
|
||||
const subTitle: string =
|
||||
"Explore the latest news, tips, and insights from ScrewFast to enhance your construction projects. From product spotlights to project management strategies, our blog is your go-to resource for all things hardware and construction.";
|
||||
const secondTitle: string = "Insights";
|
||||
const secondSubTitle: string =
|
||||
"Stay up-to-date with the latest trends and developments in the construction industry with insights from ScrewFast's team of industry experts. ";
|
||||
|
||||
const pageTitle: string = `Blog | ${SITE.title}`;
|
||||
---
|
||||
|
||||
<MainLayout
|
||||
title={pageTitle}
|
||||
structuredData={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
"@id": "https://screwfast.uk/blog",
|
||||
"url": "https://screwfast.uk/blog",
|
||||
"name": "Blog | ScrewFast",
|
||||
"description": "Stay up-to-date with the latest trends and developments in the construction industry with insights from ScrewFast's team of industry experts.",
|
||||
"isPartOf": {
|
||||
"@type": "WebSite",
|
||||
"url": "https://screwfast.uk",
|
||||
"name": "ScrewFast",
|
||||
"description": "ScrewFast offers top-tier hardware tools and expert construction services to meet all your project needs."
|
||||
},
|
||||
"inLanguage": "en-US"
|
||||
}}
|
||||
>
|
||||
<section
|
||||
class="mx-auto max-w-[85rem] space-y-8 px-4 pt-16 sm:px-6 lg:px-8 2xl:max-w-full"
|
||||
>
|
||||
<!--Page header-->
|
||||
<div class="mx-auto max-w-3xl text-left sm:text-center">
|
||||
<h1
|
||||
class="block text-balance text-4xl font-bold tracking-tight text-neutral-800 dark:text-neutral-200 md:text-5xl lg:text-6xl"
|
||||
>
|
||||
{title}
|
||||
</h1>
|
||||
|
||||
<p
|
||||
class="mt-4 text-pretty text-lg text-neutral-600 dark:text-neutral-400"
|
||||
>
|
||||
{subTitle}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="mx-auto max-w-[85rem] px-4 py-10 sm:px-6 lg:px-8 lg:py-14 2xl:max-w-full"
|
||||
>
|
||||
<!--Blog posts grid-->
|
||||
<div class="grid gap-6 lg:grid-cols-2">
|
||||
{otherPosts.map((blogEntry) => <CardBlog blogEntry={blogEntry} />)}
|
||||
</div>
|
||||
</section>
|
||||
<!--Most recent blog post-->
|
||||
<section
|
||||
class="mx-auto max-w-[85rem] px-4 py-10 sm:px-6 lg:px-8 lg:py-14 2xl:max-w-full"
|
||||
>
|
||||
<CardBlogRecent blogEntry={mostRecentPost} />
|
||||
</section>
|
||||
<!--Insights section-->
|
||||
<section
|
||||
class="mx-auto max-w-[85rem] px-4 py-10 sm:px-6 lg:px-8 lg:py-14 2xl:max-w-full"
|
||||
>
|
||||
<div class="mx-auto mb-10 max-w-2xl text-center lg:mb-14">
|
||||
<h2
|
||||
class="text-2xl font-bold text-neutral-800 dark:text-neutral-200 md:text-4xl md:leading-tight"
|
||||
>
|
||||
{secondTitle}
|
||||
</h2>
|
||||
<p class="mt-1 text-pretty text-neutral-600 dark:text-neutral-400">
|
||||
{secondSubTitle}
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{
|
||||
insightPosts.map((insightEntry) => (
|
||||
<CardInsight insightEntry={insightEntry} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</MainLayout>
|
||||
|
|
@ -24,7 +24,7 @@ export async function getStaticPaths() {
|
|||
|
||||
const { product } = Astro.props;
|
||||
|
||||
const pageTitle: string = `${product.data.main.title} | ${SITE.title}`;
|
||||
const pageTitle: string = `${product.data.title} | ${SITE.title}`;
|
||||
---
|
||||
|
||||
<MainLayout
|
||||
|
|
@ -51,10 +51,10 @@ const pageTitle: string = `${product.data.main.title} | ${SITE.title}`;
|
|||
<h1
|
||||
class="block text-4xl font-bold tracking-tighter text-neutral-800 dark:text-neutral-200 sm:text-5xl md:text-6xl lg:text-7xl"
|
||||
>
|
||||
{product.data.main.title}
|
||||
{product.data.title}
|
||||
</h1>
|
||||
<p class="text-lg text-neutral-600 dark:text-neutral-400">
|
||||
{product.data.main.subTitle}
|
||||
{product.data.description}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -96,17 +96,17 @@ const pageTitle: string = `${product.data.main.title} | ${SITE.title}`;
|
|||
<h2
|
||||
class="text-balance text-3xl font-bold tracking-tight text-neutral-800 dark:text-neutral-200 md:leading-tight lg:text-4xl"
|
||||
>
|
||||
{product.data.description.title}
|
||||
{product.data.longDescription.title}
|
||||
</h2>
|
||||
<p
|
||||
class="mt-3 text-pretty text-neutral-600 dark:text-neutral-400"
|
||||
>
|
||||
{product.data.description.subTitle}
|
||||
{product.data.longDescription.subTitle}
|
||||
</p>
|
||||
<p class="mt-5">
|
||||
<PrimaryCTA
|
||||
title={product.data.description.btnTitle}
|
||||
url={product.data.description.btnURL}
|
||||
title={product.data.longDescription.btnTitle}
|
||||
url={product.data.longDescription.btnURL}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue