Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4 #1015

Closed
3 tasks done
oekazuma opened this issue Apr 8, 2024 · 3 comments
Closed
3 tasks done

v4 #1015

oekazuma opened this issue Apr 8, 2024 · 3 comments
Assignees

Comments

@oekazuma
Copy link
Owner

oekazuma commented Apr 8, 2024

Below is a summary of what we need to do in v4.

Migration Guide

twitter.handle has been renamed twitter.creator
This change aligns with the actual property name.

v3

<MetaTags
  twitter={{
    handle: '@handle',
    site: '@site',
    cardType: 'summary_large_image',
    title: 'Twitter',
    description: 'Twitter',
    image: 'https://www.example.ie/twitter-image.jpg',
    imageAlt: 'Twitter image alt'
  }}
/>

v4

<MetaTags
  twitter={{
    creator: '@handle',
    site: '@site',
    cardType: 'summary_large_image',
    title: 'Twitter',
    description: 'Twitter',
    image: 'https://www.example.ie/twitter-image.jpg',
    imageAlt: 'Twitter image alt'
  }}
/>

Add deepMerge, a function that deeply merges the enumerable properties of two or more objects.

The use of the deepMerge function provided by this library is not mandatory, so you can continue to use whatever you like, but it is recommended because it reduces dependencies.

See Example for details on how to use it.

v3

+layout.svelte

<script>
  import { MetaTags } from 'svelte-meta-tags';
  import { page } from '$app/stores';
  import extend from 'just-extend'; // Use functions that allow deep merging of objects such as lodash.merge, deepmerge, and just-extend

  export let data;

  $: metaTags = extend(true, {}, data.baseMetaTags, $page.data.pageMetaTags);
</script>

<MetaTags {...metaTags} />

<slot />

v4

+layout.svelte

<script>
  import { MetaTags, deepMerge } from 'svelte-meta-tags';
  import { page } from '$app/stores';

  let { data, children } = $props();

  let metaTags = $derived(deepMerge(data.baseMetaTags, $page.data.pageMetaTags));
</script>

<MetaTags {...metaTags} />

{@render children()}
@oekazuma oekazuma self-assigned this Apr 8, 2024
@oekazuma oekazuma pinned this issue Apr 8, 2024
This was referenced May 1, 2024
Merged
@fromaline
Copy link

Thanks for your work! Great package!

@cowboycodr
Copy link

What's the status on Svelte 5 support?

@oekazuma
Copy link
Owner Author

@cowboycodr
Even at this point, svelte-meta-tags works with Svelte 5 projects.
We plan to release a version with full support for Svelte 5 as soon as possible after Svelte 5 is officially released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants