GithubHelp home page GithubHelp logo

Comments (4)

samuelstroschein avatar samuelstroschein commented on May 23, 2024

When using any type of internalization plugin the meta fields don't update on language change.

That's likely because metaTags is not reactive. You shouldn't need the function updateMetaLang. Try the following:

$: metaTags = {
    title: LL.site_name(),
    description: LL.site_description(),
    languageAlternates: locales.map((locale) => ({ 
      hrefLang: locale,
      href: `https://${$page.host}/${lang}${$page.path.slice(3)}` 
    }))
}

That should be it. The $ prefix makes metaTags reactive. See more here. In a nutshell, metaTags should "rebuild" if for example LL.site_name() changes. Small remark, LL is a reactive store by itself. I am not sure if it will rebuild without the $ prefix. If it doesn't, please try to prefix LL.site_name() with the dollar sign i.e. $LL.site_name()

from svelte-meta-tags.

samuelstroschein avatar samuelstroschein commented on May 23, 2024

Another small remark:
Array.push() is not reactive in Svelte. To add elements to an array in a reactive manner, you need to re-assign the array variable. An elegant workaround is myArray = [...myArray, newElement]. Read more here

from svelte-meta-tags.

rallisf1 avatar rallisf1 commented on May 23, 2024

Thanks for the tips. I tried making metaTags reactive but didn't work, turns out LL needed a $ too...pfff

You may close this, I'm just noob :D

from svelte-meta-tags.

oekazuma avatar oekazuma commented on May 23, 2024

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from svelte-meta-tags.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.