SEO images, remove services section (for the time being)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { ImageMetadata } from "astro";
|
||||
import { getImage } from "astro:assets";
|
||||
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
type Project = CollectionEntry<"projects">;
|
||||
@@ -13,12 +14,15 @@ const allProjectHeros = import.meta.glob<{ default: ImageMetadata }>(
|
||||
{ eager: true }
|
||||
);
|
||||
|
||||
export function getProjectHero(project: Project): ImageMetadata | undefined {
|
||||
export function getProjectHero(project: Project): ImageMetadata {
|
||||
let image: ImageMetadata = Object.values(allProjectHeros)[0].default;
|
||||
for (const [path, mod] of Object.entries(allProjectHeros)) {
|
||||
if (path.includes(project.data.images.hero.src)) {
|
||||
return mod.default;
|
||||
image = mod.default;
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
export function getProjectOtherImages(project: Project): ImageMetadata[] {
|
||||
@@ -99,3 +103,10 @@ export async function convertImagesImportGlobToArray(
|
||||
|
||||
return returnedImages;
|
||||
}
|
||||
|
||||
export async function getFullExternalURLOfImage(
|
||||
image: ImageMetadata
|
||||
): Promise<string> {
|
||||
return new URL((await getImage({ src: image })).src, import.meta.env.SITE)
|
||||
.href;
|
||||
}
|
||||
|
Reference in New Issue
Block a user