1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

fix <title/> derivation bug

This commit is contained in:
checktheroads
2020-06-12 18:49:48 -07:00
parent c2e6b772c0
commit e81d9d4ed5
2 changed files with 6 additions and 18 deletions

View File

@@ -439,6 +439,7 @@ _frontend_fields = {
"request_timeout": ..., "request_timeout": ...,
"org_name": ..., "org_name": ...,
"google_analytics": ..., "google_analytics": ...,
"site_title": ...,
"site_description": ..., "site_description": ...,
"site_keywords": ..., "site_keywords": ...,
"web": ..., "web": ...,

View File

@@ -8,7 +8,7 @@ const Meta = () => {
const config = useConfig(); const config = useConfig();
const theme = useTheme(); const theme = useTheme();
const [location, setLocation] = useState({}); const [location, setLocation] = useState({});
const title = config?.org_name || "hyperglass"; const title = config?.site_title || "hyperglass";
const description = config?.site_description || "The modern looking glass."; const description = config?.site_description || "The modern looking glass.";
const siteName = `${title} - ${description}`; const siteName = `${title} - ${description}`;
const keywords = config?.site_keywords || [ const keywords = config?.site_keywords || [
@@ -27,15 +27,10 @@ const Meta = () => {
"network", "network",
"isp" "isp"
]; ];
const author = config?.org_name || "Matt Love, matt@hyperglass.io"; const language = config?.language ?? "en";
const language = config?.language || "en"; const ogImage = config?.web.opengraph.image ?? null;
const currentYear = new Date().getFullYear(); const ogImageHeight = config?.web.opengraph.height ?? null;
const copyright = config const ogImageWidth = config?.web.opengraph.width ?? null;
? `${currentYear} ${config.org_name}`
: `${currentYear} hyperglass`;
const ogImage = config?.web.opengraph.image || null;
const ogImageHeight = config?.web.opengraph.height || null;
const ogImageWidth = config?.web.opengraph.width || null;
const primaryFont = googleFontUrl(theme.fonts.body); const primaryFont = googleFontUrl(theme.fonts.body);
const monoFont = googleFontUrl(theme.fonts.mono); const monoFont = googleFontUrl(theme.fonts.mono);
useEffect(() => { useEffect(() => {
@@ -46,18 +41,12 @@ const Meta = () => {
return ( return (
<Head> <Head>
<title>{title}</title> <title>{title}</title>
<meta charSet="UTF-8" />
<meta httpEquiv="Content-Type" content="text/html" />
<meta name="hg-version" content={config.hyperglass_version} /> <meta name="hg-version" content={config.hyperglass_version} />
<meta name="description" content={description} /> <meta name="description" content={description} />
<meta name="keywords" content={keywords.join(", ")} /> <meta name="keywords" content={keywords.join(", ")} />
<meta name="author" content={author} />
<meta name="language" content={language} /> <meta name="language" content={language} />
<meta name="copyright" content={copyright} />
<meta name="url" content={location.href} /> <meta name="url" content={location.href} />
<meta name="og:title" content={title} /> <meta name="og:title" content={title} />
<meta name="og:type" content="website" />
<meta name="og:site_name" content={siteName} />
<meta name="og:url" content={location.href} /> <meta name="og:url" content={location.href} />
<meta name="og:image" content={ogImage} /> <meta name="og:image" content={ogImage} />
<meta name="og:description" content={description} /> <meta name="og:description" content={description} />
@@ -70,6 +59,4 @@ const Meta = () => {
); );
}; };
Meta.displayName = "Meta";
export default Meta; export default Meta;