mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 16:28:28 -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 Head from "next/head";
|
||||
import { useTheme } from "next-themes";
|
||||
import { githubRepo } from "../../lib/config";
|
||||
|
||||
@ -40,21 +39,11 @@ const Comments = (props: Props) => {
|
||||
}, [resolvedTheme]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<link rel="preload" href="https://utteranc.es/client.js" as="script" crossOrigin="anonymous" />
|
||||
</Head>
|
||||
|
||||
<div ref={scriptRef} id="comments" />
|
||||
|
||||
<style jsx>{`
|
||||
div {
|
||||
margin-top: 2em;
|
||||
padding-top: 1em;
|
||||
border-top: 2px solid var(--light);
|
||||
}
|
||||
`}</style>
|
||||
</>
|
||||
<div
|
||||
ref={scriptRef}
|
||||
id="comments"
|
||||
style={{ marginTop: "2em", paddingTop: "1em", borderTop: "2px solid var(--light)" }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import Head from "next/head";
|
||||
import { NextSeo, ArticleJsonLd } from "next-seo";
|
||||
import { escape } from "html-escaper";
|
||||
import { getMDXComponent } from "mdx-bundler/client";
|
||||
@ -17,6 +18,15 @@ const Note = ({ frontMatter, mdxSource }) => {
|
||||
|
||||
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
|
||||
title={frontMatter.title}
|
||||
description={frontMatter.description}
|
||||
|
Loading…
x
Reference in New Issue
Block a user