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

Investigate Feasibility: Social Sharing Previews #39

Closed
apbendi opened this issue Apr 22, 2020 · 2 comments
Closed

Investigate Feasibility: Social Sharing Previews #39

apbendi opened this issue Apr 22, 2020 · 2 comments
Assignees
Labels
enhancement Minor improvement to existing functionality pending Pending Client Review & Acceptance

Comments

@apbendi
Copy link
Contributor

apbendi commented Apr 22, 2020

Social Sharing Previews for links to poll results pages should show

  • Poll Title
  • Winning Or Leading Option
  • Winning Or Leading Option Vote Percentage By Token Weight

Example:

IMAGE 2020-04-22 07:19:31

Might show something like:

POAP VOTE

Devcon IV Location
Buenos Aires (83%)

Note: The feasibility needs investigation here. Social previews are generated from header metadata. How easily can we populate this dynamically? It may be prohibitively difficult without a costly architecture change. We will investigate this

@apbendi apbendi added the pending Pending Client Review & Acceptance label Apr 22, 2020
@apbendi apbendi added enhancement Minor improvement to existing functionality and removed pending Pending Client Review & Acceptance labels Apr 22, 2020
@apbendi apbendi changed the title Social Sharing Previews Investigate Feasibility: Social Sharing Previews Apr 22, 2020
@apbendi apbendi added this to To do in POAP Vote V1 via automation Apr 22, 2020
@mds1
Copy link
Contributor

mds1 commented Apr 24, 2020

Ok, some notes on this below. Let me know your thoughts feedback on everything.

Page Title

Changing the page title is easy, and I think we should do this anyway since it is very simple. Though it may or may not change social sharing link previews. Suggested titles to use:

  • "Vote: | POAP Vote" for the vote pages (or do you prefer Cast)?
  • "Results: | POAP Vote" for the results pages
  • "Home | POAP Vote" or "View Polls | POAP Vote" for the home page.

See example image below:

image

Previews

Getting more specific than just the title gets tricker. The good part is pretty much every uses The Open Graph protocol (TOGP) to generate the previews. This requires special meta tags in the html head.

Some specifics:

Setting a pretty preview using TOGP meta tags that is constant for all pages is easy, as we just hardcode the desired properties in our index.template.html file. As a result, we should probably do this also.

Doing this dynamically per-poll is not as straightforward.

From some googling, reading the Quasar discord server, and some forum posts it seems this requires Server-Side Rendering (SSR) (Vue SSR docs, Quasar SSR docs), where you "render the same components into HTML strings on the server, send them directly to the browser, and finally “hydrate” the static markup into a fully interactive app on the client."

SSR is required because otherwise meta tags are only loaded once the first time the app loads, whereas SSR lets you send the dynamic meta tags with the HTM on each page load. So you are correct—it does require an architecture change. (Other benefits of SSR are that it helps with SEO and reduces loading time on devices with slow internet connections).

Quasar does have a Meta plugin which will facilitate configuring TOGP tags on SSR.

If we do implement this feature, https://metatags.io/ is a good site for testing the implementation before deploying.

Estimated Work

Kind of like when you write upgradable contracts, writing for SSR requires special considerations and patterns. I read through the Quasar docs on what changes are required, and while it's a non-trivial amount of work, it doesn't seem like there's any dealbreakers. The important caveat is I've never worked with SSR before so of course there may be things I'm missing or unforseen problems.

The one potential issue is that browser-only globals have to be accessed in lifecycle hooks. So when we call window.web3 to get a signature we might need to do some hacky workaround for that, where we move that call into the mounted lifecycle hook of a blank component that has no html.

This would likely also change the server configuration for deployment, though I haven't looked into exactly how.

Having said all that, here's an hours estimate: I'd probably estimate ~2 full days (~16 hours) to configure SSR + TOGP meta tags, maybe quicker if everything were to go perfect with no hurdles. It really doesn't seem like there's major changes to be made, but it's tough to give a good estimate due to unknown unknowns

@mds1 mds1 moved this from To do to In progress in POAP Vote V1 Apr 24, 2020
@apbendi apbendi added the pending Pending Client Review & Acceptance label May 1, 2020
@apbendi apbendi moved this from In progress to To do in POAP Vote V1 May 1, 2020
@apbendi
Copy link
Contributor Author

apbendi commented May 4, 2020

Decided this is not worth the complexity/effort right now. Closing.

@apbendi apbendi closed this as completed May 4, 2020
POAP Vote V1 automation moved this from To do to Done May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Minor improvement to existing functionality pending Pending Client Review & Acceptance
Projects
POAP Vote V1
  
Done
Development

No branches or pull requests

2 participants