Skip to content

Commit d8e2e9d

Browse files
committed
fix(meta): fix meta open graph bug
Update the meta props from name to property as per required by facebook dev docs fix #11
1 parent c321707 commit d8e2e9d

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useEffect, useState } from 'react';
55

66
const spinnerFrames = ['◐', '◓', '◑', '◒'];
77

8-
const Meta = ({ loading }: { loading?: boolean }) => {
8+
const Meta: React.FC<{ loading?: boolean }> = ({ loading }) => {
99
const [searchParams, _setSearchParams] = useSearchParams();
1010
const { pathname, search } = useLocation();
1111
const [currentSpinnerFrame, setCurrentSpinnerFrame] = useState(
@@ -15,7 +15,7 @@ const Meta = ({ loading }: { loading?: boolean }) => {
1515
const domain = searchParams.get('domain');
1616

1717
const title = `${loading ? currentSpinnerFrame + ' - ' : ''} ${
18-
domain ? `${domain} - ` : ''
18+
domain ? domain + ' - ' : ''
1919
}DomainLookup`;
2020
const currentUrl = BASE_URL + pathname + search;
2121

@@ -26,26 +26,22 @@ const Meta = ({ loading }: { loading?: boolean }) => {
2626
const nextIndex =
2727
(spinnerFrames.indexOf(prev) + 1) % spinnerFrames.length;
2828

29-
console.log(nextIndex);
3029
return spinnerFrames[nextIndex];
3130
});
32-
}, 200);
31+
}, 250);
3332

3433
return () => clearInterval(spinnerInterval);
3534
}, [loading]);
3635

3736
return (
3837
<Helmet>
39-
<meta charSet="UTF-8" />
40-
<link rel="icon" type="image/svg+xml" href="/dl-logo.png" />
41-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
4238
<title>{title}</title>
4339
<meta name="description" content={DESCRIPTION} />
44-
<meta name="og:title" content={title} />
45-
<meta name="og:type" content={TYPE} />
46-
<meta name="og:description" content={DESCRIPTION} />
47-
<meta name="og:image" content={`${BASE_URL}/og-dl.png`} />
48-
<meta name="og:url" content={currentUrl} />
40+
<meta property="og:title" content={title} />
41+
<meta property="og:type" content={TYPE} />
42+
<meta property="og:description" content={DESCRIPTION} />
43+
<meta property="og:image" content={`${BASE_URL}/og-dl.png`} />
44+
<meta property="og:url" content={currentUrl} />
4945
</Helmet>
5046
);
5147
};

src/views/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SearchForm from '../components/SearchForm';
44
import Logo from '../components/Logo';
55
import { useSearchParams } from 'react-router-dom';
66
import { useEffect } from 'react';
7-
import Meta from '../hoc/Meta';
7+
import Meta from '../components/Meta';
88

99
const Home = () => {
1010
const [_searchParams, setSearchParams] = useSearchParams();

src/views/Results.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { H1 } from '../hoc/H1';
1717
import Markers from '../components/Markers';
1818
import { isWordpressInstalled } from '../services/wpCheck.service';
1919
import { isCdnActive } from '../services/cdnCheck.service';
20-
import Meta from '../hoc/Meta';
20+
import Meta from '../components/Meta';
2121

2222
interface WhoIsData {
2323
result?: Record<string, any>;

0 commit comments

Comments
 (0)