1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Helmet } from 'react-helmet';
4 import { useTranslation } from 'react-i18next';
6 const CanonicalLinks = ({ base, lang, langs }) => {
7 const { i18n } = useTranslation();
9 const activeLang = lang || i18n.language;
10 const availableLangs = langs || ['de', 'en'];
14 href={`https://alttp.localhorst.tv${base}?lng=${activeLang}`}
19 href={`https://alttp.localhorst.tv${base}`}
23 {availableLangs.filter(l => l !== activeLang).map(l =>
26 href={`https://alttp.localhorst.tv${base}?lng=${l}`}
34 CanonicalLinks.propTypes = {
35 base: PropTypes.string.isRequired,
36 lang: PropTypes.string,
37 langs: PropTypes.arrayOf(PropTypes.string),
40 export default CanonicalLinks;