import axios from 'axios';
import React, { useEffect, useState } from 'react';
+import { Helmet } from 'react-helmet';
import { withTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import Loading from '../common/Loading';
import NotFound from '../pages/NotFound';
import Detail from '../techniques/Detail';
-import { getTranslation } from '../../helpers/Technique';
+import { getLanguages, getTranslation } from '../../helpers/Technique';
import i18n from '../../i18n';
const Technique = () => {
};
}, [name]);
- useEffect(() => {
- if (technique) {
- window.document.title = getTranslation(technique, 'title', i18n.language);
- }
- }, [technique, i18n.language]);
-
if (loading) {
return <Loading />;
}
}
return <ErrorBoundary>
+ <Helmet>
+ <title>{getTranslation(technique, 'title', i18n.language)}</title>
+ <meta name="description" content={getTranslation(technique, 'short', i18n.language)} />
+ <link
+ href={`https://alttp.localhorst.tv/tech/${technique.name}`}
+ hrefLang="x-default"
+ rel="alternate"
+ />
+ {getLanguages(technique).map(l =>
+ <link
+ key={l}
+ href={`https://alttp.localhorst.tv/tech/${technique.name}?lng=${l}`}
+ hrefLang={l}
+ rel="alternate"
+ />
+ )}
+ </Helmet>
<Detail technique={technique} />
</ErrorBoundary>;
};