Skip to content

Commit

Permalink
fix: add meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dlcastillop committed Mar 18, 2023
1 parent a75ca46 commit 2ba1c80
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
37 changes: 36 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,42 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>

<!-- Primary Meta Tags -->
<meta name="title" content="" />
<meta
name="description"
content="Organize all your payment methods with PayLink."
/>

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="" />
<meta property="og:title" content="" />
<meta
property="og:description"
content="Organize all your payment methods with PayLink."
/>
<meta
property="og:image"
content="./images/opengraph/paylink-opengraph.png"
/>

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="" />
<meta property="twitter:title" content="" />
<meta
property="twitter:description"
content="Organize all your payment methods with PayLink."
/>
<meta
property="twitter:image"
content="./images/opengraph/paylink-opengraph.png"
/>

<title></title>

<link
rel="icon"
type="image/svg+xml"
Expand Down
22 changes: 22 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ import Config from "./paylink.config.json";

const App = () => {
const [qrData, setQrData] = useState({ img: "", label: "", value: "" });
const title = "PayLink | Pay or donate to " + Config.properties.name;

// Set title tag
document.title = title;

// Set meta tag (title)
let meta = document.querySelectorAll("meta")[2];
meta.setAttribute("content", title);

// Set meta tag (og:url and title)
meta = document.querySelectorAll("meta")[5];
meta.setAttribute("og:url", window.location);

meta = document.querySelectorAll("meta")[6];
meta.setAttribute("og:title", title);

// Set meta tag (twitter:url and twitter:title)
meta = document.querySelectorAll("meta")[10];
meta.setAttribute("twitter:url", window.location);

meta = document.querySelectorAll("meta")[11];
meta.setAttribute("twitter:title", title);

return (
<div className="max-w-xl mx-auto items-center justify-center">
Expand Down

0 comments on commit 2ba1c80

Please sign in to comment.