Use server detected host for sharing URLs

This commit is contained in:
2020-03-28 12:48:59 +01:00
parent 3a4b1c2c85
commit fbdbe21dd6
5 changed files with 22 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
<script> <script>
import { onMount } from 'svelte'
import { site } from '../utils/store' import { site } from '../utils/store'
// Components // Components
@@ -12,20 +11,18 @@
// Props // Props
export let status export let status
export let error export let error
/*
** Run code on browser only
*/
onMount(() => {
})
</script> </script>
<svelte:head> <svelte:head>
<title>{$site.seo_name} - {error.message}</title> <title>{$site.seo_name} - {error.message}</title>
</svelte:head> </svelte:head>
{#if process.env.NODE_ENV === 'development' && error.stack}
<div class="wrap">
<pre>{error.stack}</pre>
</div>
{/if}
<section class="page"> <section class="page">
<div class="wrap"> <div class="wrap">
<div class="page__top"> <div class="page__top">
@@ -38,10 +35,7 @@
</div> </div>
<div class="page__description style-description"> <div class="page__description style-description">
<p> <p>Oh no… Looks like something wrong just happened. Like a nasty error {status}.</p>
Oh no…
Looks like something wrong just happened. Like a nasty error {status}.
</p>
<Button href="/" class="button" text="Go back to the homepage" on:click={() => window.location.href = '/'} /> <Button href="/" class="button" text="Go back to the homepage" on:click={() => window.location.href = '/'} />
</div> </div>
@@ -50,10 +44,3 @@
<Footer /> <Footer />
</section> </section>
{#if process.env.NODE_ENV === 'development' && error.stack}
<div class="wrap">
<pre>{error.stack}</pre>
</div>
{/if}

View File

@@ -1,5 +1,6 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { stores } from '@sapper/app'
import { import {
site, site,
currentLocation, currentLocation,
@@ -20,6 +21,9 @@
import { animateIn } from '../animations/page' import { animateIn } from '../animations/page'
pageTransition.onAnimationEnd = animateIn pageTransition.onAnimationEnd = animateIn
// Variables
const { page } = stores()
// Reset current location if existing // Reset current location if existing
$: { $: {
@@ -41,7 +45,7 @@
<title>{$site.seo_name} - {$site.seo_title_default} of planet Earth</title> <title>{$site.seo_name} - {$site.seo_title_default} of planet Earth</title>
<meta name="description" content={$site.description}> <meta name="description" content={$site.description}>
<SocialMetas <SocialMetas
url="https://housesof.world" url="https://{$page.host}/choose"
title="{$site.seo_name} - {$site.seo_title_default} planet Earth" title="{$site.seo_name} - {$site.seo_title_default} planet Earth"
description={$site.seo_description_default} description={$site.seo_description_default}
image={$site.seo_share_image.full_url} image={$site.seo_share_image.full_url}

View File

@@ -1,5 +1,6 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { stores } from '@sapper/app'
import { site, pageReady, pageTransition } from '../utils/store' import { site, pageReady, pageTransition } from '../utils/store'
// Components // Components
@@ -14,6 +15,9 @@
import { animateIn } from '../animations/page' import { animateIn } from '../animations/page'
pageTransition.onAnimationEnd = animateIn pageTransition.onAnimationEnd = animateIn
// Variables
const { page } = stores()
/* /*
** Run code when mounted ** Run code when mounted
@@ -28,7 +32,7 @@
<title>{$site.seo_name} - Credits</title> <title>{$site.seo_name} - Credits</title>
<meta name="description" content={$site.credits_text}> <meta name="description" content={$site.credits_text}>
<SocialMetas <SocialMetas
url="https://housesof.world/credits" url="https://{$page.host}/credits"
title="{$site.seo_name} - Credits" title="{$site.seo_name} - Credits"
description={$site.credits_text} description={$site.credits_text}
image={$site.seo_share_image.full_url} image={$site.seo_share_image.full_url}

View File

@@ -27,6 +27,7 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { stores } from '@sapper/app'
import { import {
currentLocation, currentLocation,
currentPhotos, currentPhotos,
@@ -55,6 +56,7 @@
// Props and variables // Props and variables
export let photos export let photos
const { page } = stores()
// Reset current location if existing // Reset current location if existing
$: { $: {
@@ -76,7 +78,7 @@
<title>{$site.seo_name} - {$site.seo_title_default} planet Earth</title> <title>{$site.seo_name} - {$site.seo_title_default} planet Earth</title>
<meta name="description" content={$site.seo_description_default}> <meta name="description" content={$site.seo_description_default}>
<SocialMetas <SocialMetas
url="https://housesof.world" url="https://{$page.host}"
title="{$site.seo_name} - {$site.seo_title_default} planet Earth" title="{$site.seo_name} - {$site.seo_title_default} planet Earth"
description={$site.seo_description_default} description={$site.seo_description_default}
image={$site.seo_share_image.full_url} image={$site.seo_share_image.full_url}

View File

@@ -32,7 +32,6 @@
pageTransition pageTransition
} from '../../../utils/store' } from '../../../utils/store'
import { formatDate, relativeTime, getThumbnail } from '../../../utils/functions' import { formatDate, relativeTime, getThumbnail } from '../../../utils/functions'
const { page } = stores()
// Dependencies // Dependencies
import lazySizes from 'lazysizes' import lazySizes from 'lazysizes'
@@ -54,6 +53,7 @@
// Props and variables // Props and variables
export let photos export let photos
const { page } = stores()
let layoutSetting let layoutSetting
// Update current location // Update current location
@@ -99,7 +99,7 @@
<title>{$site.seo_name} Beautiful houses of {location.name}, {location.country.name}</title> <title>{$site.seo_name} Beautiful houses of {location.name}, {location.country.name}</title>
<meta name="description" content="{$site.seo_name} {location.name} {location.description}"> <meta name="description" content="{$site.seo_name} {location.name} {location.description}">
<SocialMetas <SocialMetas
url="https://housesof.world/location/{location.country.slug}/{location.slug}" url="https://{$page.host}/location/{location.country.slug}/{location.slug}"
title="{$site.seo_name} Beautiful houses of {location.name}, {location.country.name}" title="{$site.seo_name} Beautiful houses of {location.name}, {location.country.name}"
description="{$site.seo_name} {location.name} {location.description}" description="{$site.seo_name} {location.name} {location.description}"
image={latestPhoto ? getThumbnail(latestPhoto.image.private_hash, 1200, 630) : null} image={latestPhoto ? getThumbnail(latestPhoto.image.private_hash, 1200, 630) : null}