Skip to content

Commit

Permalink
Merge pull request #176 from poap-xyz/meta-no-space
Browse files Browse the repository at this point in the history
Meta no space
  • Loading branch information
jm42 authored Apr 7, 2024
2 parents df7848b + 2349d19 commit c6fd6bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions netlify/edge-functions/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ async function getEventInfo(eventId) {
function replaceMeta(html, title, description, image, url) {
return html
.replace(/<title>([^<]+)<\/title>/, `<title>$1: ${title}</title>`)
.replace(/<meta property="([^:]+):title" content="[^"]+" \/>/g, `<meta property="$1:title" content="${title}" />`)
.replace(/<meta name="description" content="[^"]+" \/>/, `<meta name="description" content="${description}" />`)
.replace(/<meta property="([^:]+):description" content="[^"]+" \/>/g, `<meta property="$1:description" content="${description}" />`)
.replace(/<meta property="([^:]+):image" content="[^"]+" \/>/g, `<meta property="$1:image" content="${image}" />`)
.replace(/<meta property="([^:]+):url" content="[^"]+" \/>/g, `<meta property="$1:url" content="${url}" />`)
.replace(/<meta property="([^:]+):title" content="[^"]+" ?\/>/g, `<meta property="$1:title" content="${title}"/>`)
.replace(/<meta name="description" content="[^"]+" ?\/>/, `<meta name="description" content="${description}"/>`)
.replace(/<meta property="([^:]+):description" content="[^"]+" ?\/>/g, `<meta property="$1:description" content="${description}"/>`)
.replace(/<meta property="([^:]+):image" content="[^"]+" ?\/>/g, `<meta property="$1:image" content="${image}"/>`)
.replace(/<meta property="([^:]+):url" content="[^"]+" ?\/>/g, `<meta property="$1:url" content="${url}"/>`)
}

function escapeHtml(str) {
Expand Down
10 changes: 5 additions & 5 deletions netlify/edge-functions/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ async function getMetrics(eventIds) {
function replaceMeta(html, title, description, image, url) {
return html
.replace(/<title>([^<]+)<\/title>/, `<title>$1: ${title}</title>`)
.replace(/<meta property="([^:]+):title" content="[^"]+" \/>/g, `<meta property="$1:title" content="${title}" />`)
.replace(/<meta name="description" content="[^"]+" \/>/, `<meta name="description" content="${description}" />`)
.replace(/<meta property="([^:]+):description" content="[^"]+" \/>/g, `<meta property="$1:description" content="${description}" />`)
.replace(/<meta property="([^:]+):image" content="[^"]+" \/>/g, `<meta property="$1:image" content="${image}" />`)
.replace(/<meta property="([^:]+):url" content="[^"]+" \/>/g, `<meta property="$1:url" content="${url}" />`)
.replace(/<meta property="([^:]+):title" content="[^"]+" ?\/>/g, `<meta property="$1:title" content="${title}"/>`)
.replace(/<meta name="description" content="[^"]+" ?\/>/, `<meta name="description" content="${description}"/>`)
.replace(/<meta property="([^:]+):description" content="[^"]+" ?\/>/g, `<meta property="$1:description" content="${description}"/>`)
.replace(/<meta property="([^:]+):image" content="[^"]+" ?\/>/g, `<meta property="$1:image" content="${image}"/>`)
.replace(/<meta property="([^:]+):url" content="[^"]+" ?\/>/g, `<meta property="$1:url" content="${url}"/>`)
}

function escapeHtml(str) {
Expand Down

0 comments on commit c6fd6bf

Please sign in to comment.