Replace hardcoded constants with variables from constants file
This commit is contained in:
parent
3431077897
commit
18e31d3121
10 changed files with 50 additions and 15 deletions
|
|
@ -5,6 +5,7 @@ import EmailFooterInput from "../ui/forms/input/EmailFooterInput.astro";
|
|||
import enStrings from "@/utils/navigation.ts";
|
||||
import frStrings from "@/utils/fr/navigation.ts";
|
||||
import Icon from "../ui/icons/Icon.astro";
|
||||
import { SITE } from "@/data_files/constants";
|
||||
|
||||
// Select the correct translation based on the page's lang prop:
|
||||
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">
|
||||
<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
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
import Meta from "@/components/Meta.astro";
|
||||
import Navbar from "@/components/sections/Navbar.astro";
|
||||
import FooterSection from "@/components/sections/FooterSection.astro";
|
||||
import { SITE } from "@/data_files/constants";
|
||||
|
||||
// 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 Props {
|
||||
|
|
@ -75,7 +76,7 @@ We set the language of the page to English and add classes for scrollbar and scr
|
|||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
|
||||
html.lenis,
|
||||
html.lenis body {
|
||||
height: auto;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
// Import section components
|
||||
import MainLayout from "@/layouts/MainLayout.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
|
||||
const title: string = "404";
|
||||
|
|
@ -12,7 +16,8 @@ const btnTitle: string = "Go Back";
|
|||
---
|
||||
|
||||
<MainLayout
|
||||
title="Page Not Found | ScrewFast">
|
||||
title={pageTitle}
|
||||
>
|
||||
<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-sm text-center">
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { Image } from "astro:assets";
|
|||
import { capitalize, formatDate } from "@/utils/utils";
|
||||
import { getCollection } 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
|
||||
export async function getStaticPaths() {
|
||||
|
|
@ -32,9 +33,14 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection("blog");
|
|||
const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
|
||||
(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">
|
||||
<div class="max-w-2xl">
|
||||
<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 { 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(
|
||||
|
|
@ -15,7 +16,7 @@ const blogPosts: CollectionEntry<"blog">[] = (await getCollection("blog")).sort(
|
|||
// 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);
|
||||
|
|
@ -27,10 +28,12 @@ const subTitle: string =
|
|||
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="Blog | ScrewFast"
|
||||
<MainLayout
|
||||
title={pageTitle}
|
||||
structuredData={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
|
|
|
|||
|
|
@ -2,11 +2,14 @@
|
|||
// Import the necessary components
|
||||
import MainLayout from "@/layouts/MainLayout.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-->
|
||||
<MainLayout
|
||||
title="Contact | ScrewFast"
|
||||
title={pageTitle}
|
||||
structuredData={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
// Import section components
|
||||
import { SITE } from "@/data_files/constants";
|
||||
import MainLayout from "@/layouts/MainLayout.astro";
|
||||
import { Image } from "astro:assets";
|
||||
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
|
||||
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">
|
||||
<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">
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import ProductTabBtn from "@/components/ui/buttons/ProductTabBtn.astro";
|
|||
import PrimaryCTA from "@/components/ui/buttons/PrimaryCTA.astro";
|
||||
import { Image } from "astro:assets";
|
||||
import { getCollection } from "astro:content";
|
||||
import { SITE } from "@/data_files/constants";
|
||||
|
||||
// Global declaration for gsap animation library
|
||||
declare global {
|
||||
|
|
@ -22,9 +23,13 @@ export async function getStaticPaths() {
|
|||
}
|
||||
|
||||
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>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import TestimonialsSectionAlt from "@/components/sections/testimonials/Testimoni
|
|||
// Importing necessary functions from Astro
|
||||
import { getCollection } 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
|
||||
const product: CollectionEntry<"products">[] = (
|
||||
|
|
@ -57,10 +58,12 @@ const testimonials = [
|
|||
avatarAlt: "Image Description",
|
||||
},
|
||||
];
|
||||
|
||||
const pageTitle: string = `Products | ${SITE.title}`;
|
||||
---
|
||||
|
||||
<MainLayout
|
||||
title="Products | ScrewFast"
|
||||
<MainLayout
|
||||
title={pageTitle}
|
||||
structuredData={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import aerialView from "@/images/aerial-view.avif";
|
|||
import usingTools from "@/images/using-tools.avif";
|
||||
import progressBuilding from "@/images/progress-building.avif";
|
||||
import underConstruction from "@/images/under-construction.avif";
|
||||
import { SITE } from "@/data_files/constants";
|
||||
|
||||
interface Article {
|
||||
isRightSection: boolean;
|
||||
|
|
@ -90,10 +91,12 @@ const articles: Article[] = [
|
|||
btnURL: "#",
|
||||
},
|
||||
];
|
||||
|
||||
const pageTitle: string = `Services | ${SITE.title}`;
|
||||
---
|
||||
|
||||
<MainLayout
|
||||
title="Services | ScrewFast"
|
||||
<MainLayout
|
||||
title={pageTitle}
|
||||
structuredData={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue