📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
added country-codes & x-default hreflang
Blue Mouse71d979dab7a5
diff --git a/app/redux/constants/index.ts b/app/redux/constants/index.tsindex 37f2b8e96..74bcf088d 100644--- a/app/redux/constants/index.ts+++ b/app/redux/constants/index.ts@@ -289,6 +289,17 @@ export const IS_ACTIVE_COMPARE = 'is-active-compare'// List of languages with translations availableexport const whitelist: string[] = ['en', 'uk', 'pl', 'de', 'sv', 'el', 'ru', 'hi', 'zh']+export const whitelistWithCC = {+ en: 'en-GB',+ uk: 'uk-UA',+ pl: 'pl-PL',+ de: 'de-DE',+ sv: 'sv-SE',+ el: 'el-GR',+ ru: 'ru-RU',+ hi: 'hi-IN',+ zh: 'zh-Hans',+}export const defaultLanguage: string = 'en'export const languages: IStringObject = {en: 'English',diff --git a/app/root.tsx b/app/root.tsxindex 72a2e2fb9..6e5cf618d 100644--- a/app/root.tsx+++ b/app/root.tsx@@ -15,7 +15,7 @@ import {} from '@remix-run/react'import { store } from 'redux/store'import {- whitelist, isBrowser, CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted,+ whitelist, isBrowser, CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted, whitelistWithCC,} from 'redux/constants'import {getCookie, generateCookieString,@@ -226,6 +226,9 @@ export default function App() {const { title } = getPageMeta(t, url)const urlObject = new URL(url)+ urlObject.searchParams.delete('lng')++ const lnglessUrl = urlObject.toString()const alternateLinks = _map(whitelist, (lc) => {urlObject.searchParams.set('lng', lc)@@ -236,6 +239,15 @@ export default function App() {href: urlObject.toString(),}})+ const alternateLinksWithCountryCodes = _map(whitelistWithCC, (value, key) => {+ urlObject.searchParams.set('lng', key)++ return {+ rel: 'alternate',+ hrefLang: value,+ href: urlObject.toString(),+ }+ })useChangeLanguage(locale)@@ -263,9 +275,10 @@ export default function App() {<Links />{theme === 'dark' && <link rel='stylesheet' href={FlatpickrDarkCss} />}{theme === 'light' && <link rel='stylesheet' href={FlatpickrLightCss} />}- {_map(alternateLinks, (link) => (+ {_map([...alternateLinks, ...alternateLinksWithCountryCodes], (link) => (<link key={link.hrefLang} {...link} />))}+ <link rel='alternate' href={lnglessUrl} hrefLang='x-default' /><link rel='preload' href={`/locales/${locale}.json`} as='fetch' type='application/json' crossOrigin='anonymous' /><script// eslint-disable-next-line react/no-danger