Comments (4)
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.
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.
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.
🎉 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)
- Title is no longer reactive after 3.1.1 HOT 4
- Keywords metatags HOT 2
- Duplicate Json+ld in the bottom of the page HOT 3
- Support Svelte4
- Conflicting results in svelte resolve configuration HOT 3
- Support custom `robots` and `googlebot` content HOT 1
- [FEAT] - support/extend `robots` via `robotsProps.robots` HOT 2
- titleTemplate not used for <title> tag HOT 1
- Allow to set only name="robots" meta tag, or only name="googlebot" meta tag, or both
- v3 HOT 7
- Migration to monorepo
- Improved type definitions
- Usage question - override default values with new values set by child page / layout HOT 8
- What's on the roadmap? HOT 1
- og:type is not working HOT 3
- Docs: More practical examples
- Action Required: Fix Renovate Configuration
- onHide log was removed but a new version wasn't published HOT 1
- Not providing title property creates empty title tag HOT 1
- [Question/Bug]: How to use `smt` for nested layouts? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-meta-tags.