Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamically updating open graph tags for social media previews #94

Closed
n-ce opened this issue Mar 24, 2023 · 2 comments · Fixed by #187
Closed

dynamically updating open graph tags for social media previews #94

n-ce opened this issue Mar 24, 2023 · 2 comments · Fixed by #187
Assignees
Labels
enhancement New feature or request

Comments

@n-ce
Copy link
Owner

n-ce commented Mar 24, 2023

Relevant Links

Update Strategy

  • Reference relevant og tags in lib/DOM.
  • Updating them in setMetadata() =>
    const setMetadata = (thumbnail, id, streamName, authorName, authorUrl) => {
    img.dataset.src ?
    img.dataset.src = thumbnail :
    img.src = thumbnail;
    title.href = `https://youtube.com/watch?v=${id}`;
    title.textContent = streamName;
    author.href = `https://youtube.com${authorUrl}`;
    author.textContent = authorName;
    document.title = streamName + ' - ytify';
    if ('mediaSession' in navigator)
    navigator.mediaSession.metadata = new MediaMetadata({
    title: streamName,
    artist: authorName,
    artwork: [
    { src: thumbnail, sizes: '96x96' },
    { src: thumbnail, sizes: '128x128' },
    { src: thumbnail, sizes: '192x192' },
    { src: thumbnail, sizes: '256x256' },
    { src: thumbnail, sizes: '384x384' },
    { src: thumbnail, sizes: '512x512' },
    ]
    });
    }
@n-ce n-ce added the enhancement New feature or request label Mar 24, 2023
@n-ce n-ce mentioned this issue Mar 24, 2023
@n-ce n-ce linked a pull request Mar 25, 2023 that will close this issue
Closed
@n-ce n-ce self-assigned this Mar 25, 2023
@n-ce
Copy link
Owner Author

n-ce commented Mar 25, 2023

Turns out It was silly of me to do this. I totally didn't realize that social media previews only read the html and dont run any scripts.
So if we really want to implement, we will have to convert the site to a server rendered page instead which is out of the scope of this project.
On the bright side I did get to know & fix the default og-image issue as well as find a way to dom reference meta name tag without using getElementById on this endeavour.

@n-ce n-ce closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2023
@n-ce
Copy link
Owner Author

n-ce commented Jun 2, 2024

Re-opening this, as it is solvable via edge functions.
Has been already implemented by #187

@n-ce n-ce reopened this Jun 2, 2024
@n-ce n-ce linked a pull request Jun 2, 2024 that will close this issue
Merged
15 tasks
@n-ce n-ce closed this as completed in #187 Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant