Merge pull request #28 from rotary-dev-fellowship/feat-siteConstants
Enhance theme customization: refactor constants and optimize social images
This commit is contained in:
commit
1e4d5a63a7
13 changed files with 99 additions and 40 deletions
|
|
@ -1,29 +1,15 @@
|
||||||
---
|
---
|
||||||
import { getImage } from "astro:assets";
|
import { getImage } from "astro:assets";
|
||||||
|
import { OG, SEO, SITE } from "@/data_files/constants";
|
||||||
import faviconSvgSrc from "@/images/icon.svg";
|
import faviconSvgSrc from "@/images/icon.svg";
|
||||||
import faviconSrc from "@/images/icon.png";
|
import faviconSrc from "@/images/icon.png";
|
||||||
|
|
||||||
// Default properties for the Meta component. These values are used if props are not provided.
|
// Default properties for the Meta component. These values are used if props are not provided.
|
||||||
// 'title' sets the default page title for the website.
|
|
||||||
// 'meta' sets a default description meta tag to describe the page content.
|
// 'meta' sets a default description meta tag to describe the page content.
|
||||||
// 'structuredData' defines default structured data in JSON-LD format to enhance search engine understanding of the page (for SEO purposes).
|
// 'structuredData' defines default structured data in JSON-LD format to enhance search engine understanding of the page (for SEO purposes).
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
meta: "ScrewFast offers top-tier hardware tools and expert construction services to meet all your project needs. Start exploring and contact our sales team for superior quality and reliability.",
|
meta: SITE.description,
|
||||||
structuredData: {
|
structuredData: SEO.structuredData,
|
||||||
"@context": "https://schema.org",
|
|
||||||
"@type": "WebPage",
|
|
||||||
"@id": "https://screwfast.uk",
|
|
||||||
"url": "https://screwfast.uk",
|
|
||||||
"name": "ScrewFast | Top-quality Hardware Tools",
|
|
||||||
"description": "ScrewFast offers top-tier hardware tools and expert construction services to meet all your project needs.",
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extract props with default values assigned from defaultProps. Values can be overridden when the component is used.
|
// Extract props with default values assigned from defaultProps. Values can be overridden when the component is used.
|
||||||
|
|
@ -32,13 +18,12 @@ const defaultProps = {
|
||||||
const { meta = defaultProps.meta, structuredData = defaultProps.structuredData } = Astro.props;
|
const { meta = defaultProps.meta, structuredData = defaultProps.structuredData } = Astro.props;
|
||||||
|
|
||||||
// Define the metadata for your website and individual pages
|
// Define the metadata for your website and individual pages
|
||||||
const title: string = "ScrewFast"; // Set default title
|
const URL = `${Astro.site}`; // Set the website URL in astro.config.mjs
|
||||||
const ogTitle: string = "ScrewFast: Hardware Tools & Construction Services"; // Set the Open Graph title
|
const author = SITE.author;
|
||||||
const author: string = "Emil Gulamov"; // Set the author's name
|
const ogTitle = OG.title;
|
||||||
const ogDescription: string =
|
const ogDescription = OG.description;
|
||||||
"Equip your projects with ScrewFast's top-quality hardware tools and expert construction services. Trusted by industry leaders, ScrewFast offers simplicity, affordability, and reliability. Experience the difference with user-centric design and cutting-edge tools. Start exploring now!"; // Set the Open Graph description
|
const socialImageRes = await getImage({ src: OG.image, width: 1200, height: 600 });
|
||||||
const URL: string = `${Astro.site}`; // Set the website URL in astro.config.mjs
|
const socialImage = Astro.url.origin + socialImageRes.src; // Get the full URL of the image (https://stackoverflow.com/a/9858694)
|
||||||
const socialImage: string = `${Astro.site}/social.png`; // Set the path for the social media image
|
|
||||||
|
|
||||||
// Generate and optimize the favicon images
|
// Generate and optimize the favicon images
|
||||||
const faviconSvg = await getImage({
|
const faviconSvg = await getImage({
|
||||||
|
|
@ -75,7 +60,7 @@ const appleTouchIcon = await getImage({
|
||||||
<meta property="og:url" content={URL} />
|
<meta property="og:url" content={URL} />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:title" content={ogTitle} />
|
<meta property="og:title" content={ogTitle} />
|
||||||
<meta property="og:site_name" content={title} />
|
<meta property="og:site_name" content={SITE.title} />
|
||||||
<meta property="og:description" content={ogDescription} />
|
<meta property="og:description" content={ogDescription} />
|
||||||
<meta property="og:image" content={socialImage} />
|
<meta property="og:image" content={socialImage} />
|
||||||
<meta content="1200" property="og:image:width" />
|
<meta content="1200" property="og:image:width" />
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import EmailFooterInput from "../ui/forms/input/EmailFooterInput.astro";
|
||||||
import enStrings from "@/utils/navigation.ts";
|
import enStrings from "@/utils/navigation.ts";
|
||||||
import frStrings from "@/utils/fr/navigation.ts";
|
import frStrings from "@/utils/fr/navigation.ts";
|
||||||
import Icon from "../ui/icons/Icon.astro";
|
import Icon from "../ui/icons/Icon.astro";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
// Select the correct translation based on the page's lang prop:
|
// Select the correct translation based on the page's lang prop:
|
||||||
const strings = Astro.currentLocale === "fr" ? frStrings : enStrings;
|
const strings = Astro.currentLocale === "fr" ? frStrings : enStrings;
|
||||||
|
|
@ -124,7 +125,7 @@ const crafted: string = Astro.currentLocale === "fr" ? "Fabriqué par" : "Crafte
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<p class="text-sm text-neutral-600 dark:text-neutral-400">
|
<p class="text-sm text-neutral-600 dark:text-neutral-400">
|
||||||
© <span id="current-year"></span> ScrewFast. {crafted}
|
© <span id="current-year"></span> {SITE.title}. {crafted}
|
||||||
<a
|
<a
|
||||||
class="rounded-lg font-medium underline underline-offset-2 outline-none ring-zinc-500 transition duration-300 hover:text-neutral-700 hover:decoration-dashed focus:outline-none focus-visible:ring dark:ring-zinc-200 dark:hover:text-neutral-300"
|
class="rounded-lg font-medium underline underline-offset-2 outline-none ring-zinc-500 transition duration-300 hover:text-neutral-700 hover:decoration-dashed focus:outline-none focus-visible:ring dark:ring-zinc-200 dark:hover:text-neutral-300"
|
||||||
href="https://sobstvennoai.dev"
|
href="https://sobstvennoai.dev"
|
||||||
|
|
|
||||||
39
src/data_files/constants.ts
Normal file
39
src/data_files/constants.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import ogImageSrc from "@/images/social.png";
|
||||||
|
|
||||||
|
export const SITE = {
|
||||||
|
title: "ScrewFast",
|
||||||
|
tagline: "Top-quality Hardware Tools",
|
||||||
|
description: "ScrewFast offers top-tier hardware tools and expert construction services to meet all your project needs. Start exploring and contact our sales team for superior quality and reliability.",
|
||||||
|
description_short: "ScrewFast offers top-tier hardware tools and expert construction services to meet all your project needs.",
|
||||||
|
url: "https://screwfast.uk",
|
||||||
|
author: "Emil Gulamov",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SEO = {
|
||||||
|
title: SITE.title,
|
||||||
|
description: SITE.description,
|
||||||
|
structuredData: {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "WebPage",
|
||||||
|
inLanguage: "en-US",
|
||||||
|
"@id": SITE.url,
|
||||||
|
url: SITE.url,
|
||||||
|
name: SITE.title,
|
||||||
|
description: SITE.description,
|
||||||
|
isPartOf: {
|
||||||
|
"@type": "WebSite",
|
||||||
|
url: SITE.url,
|
||||||
|
name: SITE.title,
|
||||||
|
description: SITE.description,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const OG = {
|
||||||
|
locale: "en_US",
|
||||||
|
type: "website",
|
||||||
|
url: SITE.url,
|
||||||
|
title: `${SITE.title}: : Hardware Tools & Construction Services`,
|
||||||
|
description: "Equip your projects with ScrewFast's top-quality hardware tools and expert construction services. Trusted by industry leaders, ScrewFast offers simplicity, affordability, and reliability. Experience the difference with user-centric design and cutting-edge tools. Start exploring now!",
|
||||||
|
image: ogImageSrc,
|
||||||
|
};
|
||||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
|
@ -3,9 +3,10 @@
|
||||||
import Meta from "@/components/Meta.astro";
|
import Meta from "@/components/Meta.astro";
|
||||||
import Navbar from "@/components/sections/Navbar.astro";
|
import Navbar from "@/components/sections/Navbar.astro";
|
||||||
import FooterSection from "@/components/sections/FooterSection.astro";
|
import FooterSection from "@/components/sections/FooterSection.astro";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
// Setting expected props
|
// Setting expected props
|
||||||
const { title = "ScrewFast", meta, structuredData, lang = "en" } = Astro.props;
|
const { title = SITE.title, meta, structuredData, lang = "en" } = Astro.props;
|
||||||
|
|
||||||
// Interface to type-check the properties
|
// Interface to type-check the properties
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
// Import section components
|
// Import section components
|
||||||
import MainLayout from "@/layouts/MainLayout.astro";
|
import MainLayout from "@/layouts/MainLayout.astro";
|
||||||
import Btn404 from "@/components/ui/buttons/Btn404.astro";
|
import Btn404 from "@/components/ui/buttons/Btn404.astro";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
|
const pageTitle: string = `Page Not Found | ${SITE.title}`;
|
||||||
|
|
||||||
|
|
||||||
// Define variables for page content
|
// Define variables for page content
|
||||||
const title: string = "404";
|
const title: string = "404";
|
||||||
|
|
@ -12,7 +16,8 @@ const btnTitle: string = "Go Back";
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout
|
<MainLayout
|
||||||
title="Page Not Found | ScrewFast">
|
title={pageTitle}
|
||||||
|
>
|
||||||
<section class="grid h-svh place-content-center">
|
<section class="grid h-svh place-content-center">
|
||||||
<div class="mx-auto max-w-screen-xl px-4 py-8 lg:px-6 lg:py-16">
|
<div class="mx-auto max-w-screen-xl px-4 py-8 lg:px-6 lg:py-16">
|
||||||
<div class="mx-auto max-w-screen-sm text-center">
|
<div class="mx-auto max-w-screen-sm text-center">
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { Image } from "astro:assets";
|
||||||
import { capitalize, formatDate } from "@/utils/utils";
|
import { capitalize, formatDate } from "@/utils/utils";
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
import type { CollectionEntry } from "astro:content";
|
import type { CollectionEntry } from "astro:content";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
// getStaticPaths is used to pre-render all routes based on the blog posts
|
// getStaticPaths is used to pre-render all routes based on the blog posts
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
|
|
@ -32,9 +33,14 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection("blog");
|
||||||
const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
|
const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
|
||||||
(blogEntry) => blogEntry.slug !== post.slug
|
(blogEntry) => blogEntry.slug !== post.slug
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout title={post.data.title + " | ScrewFast"}>
|
<MainLayout
|
||||||
|
title={pageTitle}
|
||||||
|
>
|
||||||
<section class="mx-auto max-w-3xl px-4 pb-12 pt-6 sm:px-6 lg:px-8 lg:pt-10">
|
<section class="mx-auto max-w-3xl px-4 pb-12 pt-6 sm:px-6 lg:px-8 lg:pt-10">
|
||||||
<div class="max-w-2xl">
|
<div class="max-w-2xl">
|
||||||
<div class="mb-6 flex items-center justify-between">
|
<div class="mb-6 flex items-center justify-between">
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import CardBlogRecent from "@/components/ui/cards/CardBlogRecent.astro";
|
||||||
import CardInsight from "@/components/ui/cards/CardInsight.astro";
|
import CardInsight from "@/components/ui/cards/CardInsight.astro";
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
import type { CollectionEntry } 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
|
// Get all blogs post and sort them based on publish date
|
||||||
const blogPosts: CollectionEntry<"blog">[] = (await getCollection("blog")).sort(
|
const blogPosts: CollectionEntry<"blog">[] = (await getCollection("blog")).sort(
|
||||||
|
|
@ -27,10 +28,12 @@ const subTitle: string =
|
||||||
const secondTitle: string = "Insights";
|
const secondTitle: string = "Insights";
|
||||||
const secondSubTitle: string =
|
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. ";
|
"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
|
<MainLayout
|
||||||
title="Blog | ScrewFast"
|
title={pageTitle}
|
||||||
structuredData={{
|
structuredData={{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,14 @@
|
||||||
// Import the necessary components
|
// Import the necessary components
|
||||||
import MainLayout from "@/layouts/MainLayout.astro";
|
import MainLayout from "@/layouts/MainLayout.astro";
|
||||||
import ContactSection from "@/components/sections/ContactSection.astro";
|
import ContactSection from "@/components/sections/ContactSection.astro";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
|
const pageTitle: string = `Contact | ${SITE.title}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--Utilizing MainLayout for the outer layout of the page, and defining meta for SEO purposes-->
|
<!--Utilizing MainLayout for the outer layout of the page, and defining meta for SEO purposes-->
|
||||||
<MainLayout
|
<MainLayout
|
||||||
title="Contact | ScrewFast"
|
title={pageTitle}
|
||||||
structuredData={{
|
structuredData={{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
// Import section components
|
// Import section components
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
import MainLayout from "@/layouts/MainLayout.astro";
|
import MainLayout from "@/layouts/MainLayout.astro";
|
||||||
import { Image } from "astro:assets";
|
import { Image } from "astro:assets";
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
|
|
@ -14,9 +15,13 @@ export async function getStaticPaths() {
|
||||||
}
|
}
|
||||||
// Get the props for this page that define a specific insight post
|
// Get the props for this page that define a specific insight post
|
||||||
const { post } = Astro.props;
|
const { post } = Astro.props;
|
||||||
|
|
||||||
|
const pageTitle: string = `${post.data.title} | ${SITE.title}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout title={post.data.title + " | ScrewFast"}>
|
<MainLayout
|
||||||
|
title={pageTitle}
|
||||||
|
>
|
||||||
<section class="py-6 sm:py-8 lg:py-12">
|
<section class="py-6 sm:py-8 lg:py-12">
|
||||||
<div class="mx-auto max-w-screen-xl px-4 md:px-8">
|
<div class="mx-auto max-w-screen-xl px-4 md:px-8">
|
||||||
<div class="grid gap-8 md:grid-cols-2 lg:gap-12">
|
<div class="grid gap-8 md:grid-cols-2 lg:gap-12">
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import ProductTabBtn from "@/components/ui/buttons/ProductTabBtn.astro";
|
||||||
import PrimaryCTA from "@/components/ui/buttons/PrimaryCTA.astro";
|
import PrimaryCTA from "@/components/ui/buttons/PrimaryCTA.astro";
|
||||||
import { Image } from "astro:assets";
|
import { Image } from "astro:assets";
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
// Global declaration for gsap animation library
|
// Global declaration for gsap animation library
|
||||||
declare global {
|
declare global {
|
||||||
|
|
@ -22,9 +23,13 @@ export async function getStaticPaths() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { product } = Astro.props;
|
const { product } = Astro.props;
|
||||||
|
|
||||||
|
const pageTitle: string = `${product.data.main.title} | ${SITE.title}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout title={product.data.main.title + " | ScrewFast"}>
|
<MainLayout
|
||||||
|
title={pageTitle}
|
||||||
|
>
|
||||||
<div id="overlay" class="fixed inset-0 bg-neutral-200 dark:bg-neutral-800">
|
<div id="overlay" class="fixed inset-0 bg-neutral-200 dark:bg-neutral-800">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import TestimonialsSectionAlt from "@/components/sections/testimonials/Testimoni
|
||||||
// Importing necessary functions from Astro
|
// Importing necessary functions from Astro
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
import type { CollectionEntry } from "astro:content";
|
import type { CollectionEntry } from "astro:content";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
// Fetching all the product related content and sorting it by main.id
|
// Fetching all the product related content and sorting it by main.id
|
||||||
const product: CollectionEntry<"products">[] = (
|
const product: CollectionEntry<"products">[] = (
|
||||||
|
|
@ -57,10 +58,12 @@ const testimonials = [
|
||||||
avatarAlt: "Image Description",
|
avatarAlt: "Image Description",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const pageTitle: string = `Products | ${SITE.title}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout
|
<MainLayout
|
||||||
title="Products | ScrewFast"
|
title={pageTitle}
|
||||||
structuredData={{
|
structuredData={{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import aerialView from "@/images/aerial-view.avif";
|
||||||
import usingTools from "@/images/using-tools.avif";
|
import usingTools from "@/images/using-tools.avif";
|
||||||
import progressBuilding from "@/images/progress-building.avif";
|
import progressBuilding from "@/images/progress-building.avif";
|
||||||
import underConstruction from "@/images/under-construction.avif";
|
import underConstruction from "@/images/under-construction.avif";
|
||||||
|
import { SITE } from "@/data_files/constants";
|
||||||
|
|
||||||
interface Article {
|
interface Article {
|
||||||
isRightSection: boolean;
|
isRightSection: boolean;
|
||||||
|
|
@ -90,10 +91,12 @@ const articles: Article[] = [
|
||||||
btnURL: "#",
|
btnURL: "#",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const pageTitle: string = `Services | ${SITE.title}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout
|
<MainLayout
|
||||||
title="Services | ScrewFast"
|
title={pageTitle}
|
||||||
structuredData={{
|
structuredData={{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue