Skip to content

Commit

Permalink
perf: hardcoded strings unification
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuireu committed Aug 26, 2024
1 parent 30d6ab3 commit a9ccd09
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
5 changes: 4 additions & 1 deletion astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ export default defineConfig({
}),
],
redirects: {
"/home": "/",
"/home": {
status: 301,
destination: "/",
},
},
output: "hybrid",
adapter: cloudflare({
Expand Down
2 changes: 1 addition & 1 deletion src/const/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const PAGES_ROUTES = {
[Pages.ABOUT]: "/about",
[Pages.TAGS]: "/tags",
[Pages.CONTACT]: "/contact",
[Pages.PROJECTS]: "/contact",
[Pages.PROJECTS]: "/projects",
[Pages.TERMS_AND_CONDITIONS]: "/terms-and-conditions",
[Pages.PRIVACY_POLICY]: "/privacy-policy",
[Pages.HOME]: "/",
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Welcome from "@modules/home/components/welcome/Welcome.astro";
// todo: check metadata all pages
// todo: add small transitions & animations
// - CTAs with arrow: animate arrow
// - Latest articles (https://codepen.io/jh3y/pen/MWLyGxo)
// todo: wait for wrangler webhook --> add Algolia + filters (+ URL filtering) https://www.algolia.com/developers/contentful-search-algolia/ (webhook problem)
// todo: how to deploy cloudfare pages
Expand Down
10 changes: 10 additions & 0 deletions src/pages/projects.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getCollection } from "astro:content";
import BaseLayout from "@modules/core/components/baseLayout/BaseLayout.astro";
import ProjectSection from "@modules/projects/components/projectSection/ProjectSection.astro";
import ProjectsIntro from "@modules/projects/components/projectsIntro/ProjectsIntro.astro";
import { PAGES_ROUTES } from 'src/const';
const projects = await getCollection("projects");
---
Expand All @@ -21,6 +22,15 @@ const projects = await getCollection("projects");
<article set:html={project.data.description} />
</div>
</article>
<script is:inline type="application/ld+json" set:html={JSON.stringify({
'@context': 'https://schema.org',
'@type': 'ItemList',
'itemListElement': {
'@type': 'ListItem',
'position': index + 1,
'url': new URL(`${PAGES_ROUTES.projects}#${project.data.id}#${project.data.id}`, Astro.url).href,
},
})} />
</ProjectSection>
))}
</BaseLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const articles = await getCollection("articles");

<section class="about-latest-articles__wrapper common-wrapper">
<h3 class="about-latest-articles__title section-title">
Fresh from <a class="clickable" href={`${PAGES_ROUTES.articles}`}>the blog</a>
Fresh from <a class="clickable underline-on-action" href={`${PAGES_ROUTES.articles}`}>the blog</a>
</h3>
<div class="about-latest-articles__inner">
<div class="about-latest-articles__quote__wrapper">
Expand Down
11 changes: 6 additions & 5 deletions src/ui/modules/home/components/myWork/MyWork.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Image } from "astro:assets";
import { getCollection } from "astro:content";
import "./my-work.css";
import { PAGES_ROUTES } from 'src/const';
const projects = await getCollection("projects");
---
Expand All @@ -10,9 +11,10 @@ const projects = await getCollection("projects");
<h3 class="my-work__title section-title">My Work</h3>
<ul class="my-work__content__list flex row-wrap justify-space-between">
{projects.map((project, index) => {
return (
<li class="my-work__item">
<a class="my-work__item__link clickable" href={`/projects#${project.data.id}`}>
const projectUrl=`${PAGES_ROUTES.projects}#${project.data.id}#${project.data.id}`

return <li class="my-work__item">
<a class="my-work__item__link clickable" href={projectUrl}>
<Image
src={project.data.image.url}
alt={project.data.name}
Expand All @@ -28,10 +30,9 @@ const projects = await getCollection("projects");
'itemListElement': {
'@type': 'ListItem',
'position': index + 1,
'url': new URL(`${Astro.url}projects#${project.data.id}`, Astro.url).href,
'url': new URL(projectUrl, Astro.url).href,
},
})} />
);
})}
</ul>
</section>

0 comments on commit a9ccd09

Please sign in to comment.