Skip to content

Commit 42de890

Browse files
committed
Exclude internal URLs and subpaths (i.e., URLs that start with the same origin as the current window location) from being checked for Open Graph tags.
1 parent 4e1930c commit 42de890

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/components/link-preview/open-graph.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ export default function OpenGraphPreview({ url }) {
44
const [data, setData] = useState(null);
55

66
useEffect(() => {
7+
if (url.startsWith(window.location.origin)) {
8+
return;
9+
}
10+
console.log(url);
711
async function fetchData() {
812
const response = await fetch(url);
913
const html = await response.text();

0 commit comments

Comments
 (0)