mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-11 15:22:29 +02:00
fix(v2): fix external URL for og:image tag (#2420)
* fix(v2): og:image * Use isInternalUrl() * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
parent
2619a06076
commit
8152b47bba
2 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import Head from '@docusaurus/Head';
|
||||
import isInternalUrl from '@docusaurus/isInternalUrl';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||
|
||||
|
@ -36,8 +37,12 @@ function Layout(props) {
|
|||
version,
|
||||
} = props;
|
||||
const metaTitle = title ? `${title} | ${siteTitle}` : siteTitle;
|
||||
const metaImage = image || defaultImage;
|
||||
const metaImageUrl = siteUrl + useBaseUrl(metaImage);
|
||||
|
||||
let metaImageUrl = siteUrl + useBaseUrl(metaImage);
|
||||
if (!isInternalUrl(metaImage)) {
|
||||
metaImageUrl = metaImage;
|
||||
}
|
||||
|
||||
const faviconUrl = useBaseUrl(favicon);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue