Skip to content

Commit

Permalink
Dynamically set og:url
Browse files Browse the repository at this point in the history
  • Loading branch information
theninthsky committed Jul 3, 2022
1 parent a077be3 commit 3af8cf4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = ({ scripts, title, description, data = [] }) => `
module.exports = ({ path, title, description, scripts, data = [] }) => `
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -8,7 +8,7 @@ module.exports = ({ scripts, title, description, data = [] }) => `
<meta name="description" content="${description}">
<meta property="og:title" content="${title}">
<meta property="og:type" content="website">
<meta property="og:url" content="https://client-side-rendering.pages.dev">
<meta property="og:url" content="https://client-side-rendering.pages.dev${path}">
<meta property="og:image" content="https://client-side-rendering.pages.dev/icons/og-icon.png">
<link rel="shortcut icon" href="icons/favicon.ico">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const style = {
drawer: css`
.MuiDrawer-paper {
align-items: flex-start;
padding: 10px 15px;
padding: 10px 22px;
background-color: var(--bg-color);
}
`,
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ const style = {
`,
input: css`
margin-top: 20px;
color: #1976d2;
.MuiOutlinedInput-notchedOutline {
border: 1px solid rgba(25, 118, 210, 0.5);
}
`,
switch: css`
margin-left: -10px;
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = (_, { mode }) => {
...(production ? [] : [new ForkTsCheckerPlugin()]),
new ESLintPlugin(),
...pagesManifest.map(
({ name, title, description, vendors, data }) =>
({ name, path, title, description, vendors, data }) =>
new HtmlPlugin({
filename: `${name}.html`,
scriptLoading: 'module',
Expand All @@ -99,7 +99,7 @@ module.exports = (_, { mode }) => {

if (data && !Array.isArray(data)) data = [data]

return htmlTemplate({ scripts: [script, ...vendorScripts], title, description, data })
return htmlTemplate({ path, title, description, scripts: [script, ...vendorScripts], data })
}
})
),
Expand Down

0 comments on commit 3af8cf4

Please sign in to comment.