Add SEO share images on remaining pages

This commit is contained in:
2022-09-21 16:32:23 +02:00
parent 730a6789eb
commit a51179f6f4
5 changed files with 20 additions and 7 deletions

View File

@@ -64,6 +64,10 @@ export const load: PageServerLoad = async ({ url, setHeaders }) => {
)`} { )`} {
count { id } count { id }
} }
settings {
seo_image_photos { id }
}
}`) }`)
if (res) { if (res) {
@@ -75,6 +79,7 @@ export const load: PageServerLoad = async ({ url, setHeaders }) => {
photos: data.photos, photos: data.photos,
filteredCountryExists: data.country.length > 0, filteredCountryExists: data.country.length > 0,
totalPhotos: data.total_published[0].count.id, totalPhotos: data.total_published[0].count.id,
settings: data.settings,
} }
} }
} catch (err) { } catch (err) {

View File

@@ -13,8 +13,9 @@
import relativeTime from 'dayjs/plugin/relativeTime' import relativeTime from 'dayjs/plugin/relativeTime'
import { stagger, timeline } from 'motion' import { stagger, timeline } from 'motion'
import { DELAY } from '$utils/contants' import { DELAY } from '$utils/contants'
import { quartOut } from '$animations/easings'
import { map, lerp, throttle } from '$utils/functions' import { map, lerp, throttle } from '$utils/functions'
import { getAssetUrlKey } from '$utils/api'
import { quartOut } from '$animations/easings'
import { PUBLIC_FILTERS_DEFAULT_COUNTRY, PUBLIC_FILTERS_DEFAULT_SORT, PUBLIC_GRID_INCREMENT } from '$env/static/public' import { PUBLIC_FILTERS_DEFAULT_COUNTRY, PUBLIC_FILTERS_DEFAULT_SORT, PUBLIC_GRID_INCREMENT } from '$env/static/public'
// Components // Components
import Metas from '$components/Metas.svelte' import Metas from '$components/Metas.svelte'
@@ -34,7 +35,7 @@
let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data
$: ({ photos, totalPhotos } = data) $: ({ photos, totalPhotos } = data)
const { filteredCountryExists }: { totalPhotos: number, filteredCountryExists: boolean } = data const { filteredCountryExists, settings }: { filteredCountryExists: boolean, settings: any } = data
const { countries, locations }: any = getContext('global') const { countries, locations }: any = getContext('global')
dayjs.extend(relativeTime) dayjs.extend(relativeTime)
@@ -326,7 +327,7 @@
<Metas <Metas
title="{filterCountry === defaultCountry ? `All Photos` : `Photos of ${currentCountry.name}`} - Houses Of" title="{filterCountry === defaultCountry ? `All Photos` : `Photos of ${currentCountry.name}`} - Houses Of"
description="Discover {totalPhotos} homes from {filterCountry === defaultCountry ? `${locations.length} places of ${countries.length} countries in the World` : currentCountry.name}" description="Discover {totalPhotos} homes from {filterCountry === defaultCountry ? `${locations.length} places of ${countries.length} countries in the World` : currentCountry.name}"
image="" image={getAssetUrlKey(settings.seo_image_photos.id, 'share-image')}
/> />
<svelte:window <svelte:window

View File

@@ -47,9 +47,13 @@ export const load: PageServerLoad = async () => {
} }
} }
} }
settings {
seo_image_shop { id }
}
}`) }`)
const { data: { shop, location, posters }} = res const { data: { shop, location, posters, settings }} = res
/** /**
@@ -65,6 +69,7 @@ export const load: PageServerLoad = async () => {
locations: location, locations: location,
posters, posters,
shopProducts: shopProducts.results, shopProducts: shopProducts.results,
settings,
} }
} }
} catch (err) { } catch (err) {

View File

@@ -12,7 +12,7 @@
export let data: PageData export let data: PageData
const { shop, locations, posters, shopProducts } = data const { shop, locations, posters, shopProducts, settings } = data
let scrollY: number let scrollY: number
@@ -28,6 +28,7 @@
posters, posters,
shopLocations, shopLocations,
shopProducts, shopProducts,
settings,
}) })
</script> </script>

View File

@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import type { PageData } from './$types' import type { PageData } from './$types'
import { getContext } from 'svelte' import { getContext } from 'svelte'
import { getAssetUrlKey } from '$utils/api'
import { shopCurrentProductSlug } from '$utils/stores/shop' import { shopCurrentProductSlug } from '$utils/stores/shop'
// Components // Components
import PageTransition from '$components/PageTransition.svelte' import PageTransition from '$components/PageTransition.svelte'
@@ -12,7 +13,7 @@
export let data: PageData export let data: PageData
const { product, shopProduct }: { product: any, shopProduct: any } = data const { product, shopProduct }: { product: any, shopProduct: any } = data
const { posters }: any = getContext('shop') const { posters, settings }: any = getContext('shop')
// Update current random product slug // Update current random product slug
$shopCurrentProductSlug = product.location.slug $shopCurrentProductSlug = product.location.slug
@@ -21,7 +22,7 @@
<Metas <Metas
title="Shop Houses Of" title="Shop Houses Of"
description="Welcome to the Houses Of Shop, discover our original series of graphic posters made for lovers of design, travel and photography" description="Welcome to the Houses Of Shop, discover our original series of graphic posters made for lovers of design, travel and photography"
image="" image={getAssetUrlKey(settings.seo_image_shop.id, 'share-image')}
/> />