mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 08:58:30 -04:00
move utteranc.es preload tag
This commit is contained in:
parent
58ac05a84f
commit
379696166b
@ -1,5 +1,4 @@
|
|||||||
import { useRef, useEffect, useState } from "react";
|
import { useRef, useEffect, useState } from "react";
|
||||||
import Head from "next/head";
|
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import { githubRepo } from "../../lib/config";
|
import { githubRepo } from "../../lib/config";
|
||||||
|
|
||||||
@ -40,21 +39,11 @@ const Comments = (props: Props) => {
|
|||||||
}, [resolvedTheme]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [resolvedTheme]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div
|
||||||
<Head>
|
ref={scriptRef}
|
||||||
<link rel="preload" href="https://utteranc.es/client.js" as="script" crossOrigin="anonymous" />
|
id="comments"
|
||||||
</Head>
|
style={{ marginTop: "2em", paddingTop: "1em", borderTop: "2px solid var(--light)" }}
|
||||||
|
/>
|
||||||
<div ref={scriptRef} id="comments" />
|
|
||||||
|
|
||||||
<style jsx>{`
|
|
||||||
div {
|
|
||||||
margin-top: 2em;
|
|
||||||
padding-top: 1em;
|
|
||||||
border-top: 2px solid var(--light);
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
import Head from "next/head";
|
||||||
import { NextSeo, ArticleJsonLd } from "next-seo";
|
import { NextSeo, ArticleJsonLd } from "next-seo";
|
||||||
import { escape } from "html-escaper";
|
import { escape } from "html-escaper";
|
||||||
import { getMDXComponent } from "mdx-bundler/client";
|
import { getMDXComponent } from "mdx-bundler/client";
|
||||||
@ -17,6 +18,15 @@ const Note = ({ frontMatter, mdxSource }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{/* preload here instead of Comments.tsx -- by the time it's loaded dynamically, there's no real point anymore */}
|
||||||
|
{frontMatter.noComments !== true && (
|
||||||
|
<Head>
|
||||||
|
<link rel="preload" as="script" href="https://utteranc.es/client.js" crossOrigin="anonymous" />
|
||||||
|
<link rel="dns-prefetch" href="https://api.utteranc.es" />
|
||||||
|
<link rel="dns-prefetch" href="https://api.github.com" />
|
||||||
|
</Head>
|
||||||
|
)}
|
||||||
|
|
||||||
<NextSeo
|
<NextSeo
|
||||||
title={frontMatter.title}
|
title={frontMatter.title}
|
||||||
description={frontMatter.description}
|
description={frontMatter.description}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user