Skip to content

Commit

Permalink
Exclude internal URLs and subpaths (i.e., URLs that start with the sa…
Browse files Browse the repository at this point in the history
…me origin as the current window location) from being checked for Open Graph tags.
  • Loading branch information
MMDJafari committed Oct 27, 2023
1 parent 4e1930c commit 42de890
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/link-preview/open-graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export default function OpenGraphPreview({ url }) {
const [data, setData] = useState(null);

useEffect(() => {
if (url.startsWith(window.location.origin)) {
return;
}
console.log(url);
async function fetchData() {
const response = await fetch(url);
const html = await response.text();
Expand Down

0 comments on commit 42de890

Please sign in to comment.