mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
(nextjs) added opengraph items
This commit is contained in:
parent
2ebafbad52
commit
d7def635e3
1 changed files with 13 additions and 0 deletions
|
@ -1,7 +1,10 @@
|
||||||
import React, { VFC } from 'react';
|
import React, { VFC } from 'react';
|
||||||
|
|
||||||
|
import Head from 'next/head';
|
||||||
|
|
||||||
import { PageTitle } from '~/components/common/PageTitle';
|
import { PageTitle } from '~/components/common/PageTitle';
|
||||||
import { useNodeContext } from '~/utils/context/NodeContextProvider';
|
import { useNodeContext } from '~/utils/context/NodeContextProvider';
|
||||||
|
import { getURLFromString } from '~/utils/dom';
|
||||||
import { getPageTitle } from '~/utils/ssr/getPageTitle';
|
import { getPageTitle } from '~/utils/ssr/getPageTitle';
|
||||||
|
|
||||||
interface NodeHeadMetadataProps {}
|
interface NodeHeadMetadataProps {}
|
||||||
|
@ -12,6 +15,16 @@ const NodeHeadMetadata: VFC<NodeHeadMetadataProps> = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageTitle title={getPageTitle(node.title)} />
|
<PageTitle title={getPageTitle(node.title)} />
|
||||||
|
|
||||||
|
<Head>
|
||||||
|
<meta property="og:title" content={node.title} />
|
||||||
|
<meta property="og:type" content={node.type} />
|
||||||
|
<meta property="og:image" content={getURLFromString(node.thumbnail)} />
|
||||||
|
<meta property="og:image:secure_url" content={getURLFromString(node.thumbnail)} />
|
||||||
|
<meta property="og:image:type" content="image/jpeg" />
|
||||||
|
<meta property="og:image:alt" content={node.description} />
|
||||||
|
<meta property="og:description" content={node.description} />
|
||||||
|
</Head>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue