@lovalingo/lovalingo 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -252,7 +252,6 @@ navigateRef, // For path mode routing
252
252
  const head = document.head;
253
253
  if (!head)
254
254
  return;
255
- head.querySelectorAll('link[data-Lovalingo="hreflang"], link[data-Lovalingo="canonical"]').forEach((el) => el.remove());
256
255
  if (!bundle)
257
256
  return;
258
257
  const seo = (bundle?.seo && typeof bundle.seo === "object" ? bundle.seo : {});
@@ -321,6 +320,14 @@ navigateRef, // For path mode routing
321
320
  : typeof alternates.canonical === "string" && alternates.canonical.trim()
322
321
  ? alternates.canonical.trim()
323
322
  : "";
323
+ const languages = alternates.languages && typeof alternates.languages === "object" ? alternates.languages : {};
324
+ const hasAnyAlternate = Boolean(alternates.xDefault) || Object.values(languages).some(Boolean);
325
+ if (!canonicalHref && !(hreflangEnabled && hasAnyAlternate))
326
+ return;
327
+ // Why: search engines may ignore hreflang/canonical when multiple conflicting tags exist (we want sitemap + head parity).
328
+ head
329
+ .querySelectorAll('link[rel="canonical"], link[rel="alternate"][hreflang], link[data-Lovalingo="hreflang"], link[data-Lovalingo="canonical"]')
330
+ .forEach((el) => el.remove());
324
331
  if (canonicalHref) {
325
332
  const canonical = document.createElement("link");
326
333
  canonical.rel = "canonical";
@@ -330,7 +337,6 @@ navigateRef, // For path mode routing
330
337
  }
331
338
  if (!hreflangEnabled)
332
339
  return;
333
- const languages = alternates.languages && typeof alternates.languages === "object" ? alternates.languages : {};
334
340
  for (const [lang, href] of Object.entries(languages)) {
335
341
  if (!href)
336
342
  continue;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.5.5";
1
+ export declare const VERSION = "0.5.6";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.5.5";
1
+ export const VERSION = "0.5.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovalingo/lovalingo",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "React translation runtime with i18n routing, deterministic bundles + DOM rules, and zero-flash rendering.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",