Skip to content

Commit

Permalink
testing metadata approach
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Mar 13, 2024
1 parent 5c1c9c4 commit 142b12a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 3 additions & 0 deletions blocks/page-server/page-server.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.page-server {
display: none;
}
12 changes: 1 addition & 11 deletions blocks/page-server/page-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,7 @@ async function autoUpdatePage(main) {

await Promise.all(Array.from(metaTags).map((meta) => sanitizeMeta(meta)));

main.innerHTML = main.innerHTML.replaceAll(regex, (_match, p1) => {
// todo: besides of using metadata, try using event metadata fetched from Event Service Layer
const { pathname } = window.location;

if (p1 === 'event-name') {
const pathArray = pathname.split('/');
return titleCase(pathArray[pathArray.length - 1]);
}

return getMetadata(p1);
});
main.innerHTML = main.innerHTML.replaceAll(regex, (_match, p1) => getMetadata(p1));

// handle link replacement
main.querySelectorAll('a[href*="#"]').forEach((a) => {
Expand Down

0 comments on commit 142b12a

Please sign in to comment.