mirror of
https://github.com/KevinMidboe/planetposen-frontend.git
synced 2026-02-15 19:59:07 +00:00
Feat: Refactor jsonld & method to update document title and description (#4)
* Generates JSON ld structured metadata from a product & appends to head * Updated IProduct & IVariation interface * Added IProductResponse & IProductsResponse interfaces * Fixed sitemap urls having to many protocols * Implemented jsonld for product w/ variations * Aligned Product responses between backend & frontend * PageMeta for updating head meta values: title & description Use on any page where we want to display a unique meta page title & description * Set document language to norwegian * Linting
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { dev } from '$app/environment';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import generateProductJsonLd from '$lib/jsonld/product';
|
||||
import type { IProductResponse } from '$lib/interfaces/ApiResponse';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
@@ -12,6 +13,11 @@ export const load: PageServerLoad = async ({ fetch, params }) => {
|
||||
}
|
||||
|
||||
const res = await fetch(url);
|
||||
const product: IProductResponse = await res.json();
|
||||
return product;
|
||||
const productResponse: IProductResponse = await res.json();
|
||||
const jsonld = generateProductJsonLd(productResponse?.product);
|
||||
|
||||
return {
|
||||
product: productResponse?.product,
|
||||
jsonld
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user