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

Issue 1242 url preview #1247

Merged
merged 11 commits into from
Jan 16, 2025
Merged

Conversation

fflorent
Copy link
Collaborator

@fflorent fflorent commented Oct 4, 2024

Context

When previewing the URL of an instance (say https://docs.getgrist.com/ ) in websites or apps, it simply displays "Loading..." without any further description or images. It's quite confusing.

See #1242 for detailed steps to reproduce.

Proposed solution

  • the description defaults to "Grist is the evolution of spreadsheets." and is translatable
  • the icon defaults to statics/img/opengraph-preview-image.png (introduced in this PR)
  • the title in meta descriptions defaults to Grist, the evolution of spreadsheet, and to [doc name] - Grist if a document is consulted.

Also a technical note: I had to change the way requestUtils deduce the host of the home, so it takes into account the port. Otherwise this test failed with my change, as I now specify the absolute URL for serving static resources (needed for specifying the opengraph icon).

Related issues

Fixes #1242

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Screenshots / Screencasts

Here is how the preview of the instance link looks like on Signal:
preview home page

And how it looks like when previewing a document (:warning: Important: it must be shared publicly to obtain this result):
preview doc title

You also may check this website which seems to show the rendering of URL previews on different websites:
https://opengraph.dev/

Home page: https://opengraph.dev/panel?url=https%3A%2F%2Fgrist-fflorent-grist-core-issue-1242-url-preview.fly.dev%2F
Doc page title: https://opengraph.dev/panel?url=https%3A%2F%2Fgrist-fflorent-grist-core-issue-1242-url-preview.fly.dev%2FnbutBLRC2wSD%2Fpublic-doc

@fflorent fflorent added the preview Launch preview deployment of this PR label Oct 4, 2024
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Deployed commit 64685b3d13870d72f94c27d1c3ba91f97668d367 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-03T13:44:16.143Z)

@fflorent fflorent force-pushed the issue-1242-url-preview branch from 64685b3 to aeb4a24 Compare October 5, 2024 09:05
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Deployed commit aeb4a245d0fc661bfc347c5cb2ba03d9f7eb0d32 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-04T09:10:29.627Z)

@fflorent fflorent force-pushed the issue-1242-url-preview branch from aeb4a24 to 715b5eb Compare October 5, 2024 10:00
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Deployed commit 715b5ebbc4a28a7153efcbe35f43290af2af873a as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-04T10:05:07.677Z)

@fflorent fflorent force-pushed the issue-1242-url-preview branch from 715b5eb to 99283f7 Compare October 5, 2024 10:40
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Deployed commit 9a72269ae801372761fe6706e09ecf82540fafd4 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-04T10:46:01.039Z)

@fflorent fflorent force-pushed the issue-1242-url-preview branch from 9a72269 to 3aabb0a Compare October 5, 2024 11:42
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Deployed commit 3aabb0aea9274dd447cd2fedaa95bfd90edca5f4 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-04T11:47:21.488Z)

@fflorent fflorent marked this pull request as ready for review October 5, 2024 11:50
@fflorent fflorent requested a review from hexaltation October 5, 2024 11:50
@fflorent fflorent force-pushed the issue-1242-url-preview branch from 3aabb0a to 725aeb9 Compare October 5, 2024 12:46
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Deployed commit 725aeb9b7a469c3e691e609c9719e26bb0e891e7 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-04T12:51:34.330Z)

@fflorent fflorent force-pushed the issue-1242-url-preview branch from 725aeb9 to b81bea2 Compare October 7, 2024 08:13
Copy link
Contributor

github-actions bot commented Oct 7, 2024

Deployed commit b81bea2d058be8b43abf1f4ad4f73fafd480a7f0 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-06T08:18:40.164Z)

@@ -174,8 +174,8 @@ export function makeSendAppPage({ server, staticDir, tag, testLogin, baseDomain
).join('\n');
const content = fileContent
.replace("<!-- INSERT WARNING -->", warning)
.replace("<!-- INSERT TITLE -->", getPageTitle(req, config))
.replace("<!-- INSERT META -->", getPageMetadataHtmlSnippet(config))
.replace("<!-- INSERT TITLE -->", getPageTitle(config) ?? (translate(req, 'Loading') + "..."))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this line of code. I am a bit worried, because this seems to me a bad practice to concatenate a translated string with a punctuation.

I would rather move the ellipsis in the translation. Does it make sense to you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes at least for right to left languages.

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Deployed commit b2889474b05a2c073e6d9e662bb5783eafcaebbb as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-06T10:27:53.976Z)

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Deployed commit d752342ce4ef39596b95f1743d2464bf5c8435b0 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-06T10:52:11.687Z)

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Deployed commit 6ebbee8b8010ac42e56215cfbd0357c810c739e2 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-06T12:52:12.090Z)

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Deployed commit 6ebbee8b8010ac42e56215cfbd0357c810c739e2 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-07T07:27:13.258Z)

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Deployed commit 2464849f54edb4994fa2fff0d738839cab7da287 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-07T14:28:51.869Z)

@fflorent fflorent removed the gouv.fr label Oct 9, 2024
@fflorent fflorent requested a review from manuhabitela October 10, 2024 08:36
Copy link
Collaborator

@hexaltation hexaltation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manuhabitela
Copy link
Collaborator

Hey, great work :)

Maybe I'm saying this too late but… how about using a more "marketing" approach for og title/images? :)

1. About the image:

Most social platforms recommend using a 1200x630px image as og:image, that is generally not just a logo, but something that looks more friendly when sharing the webpage.

If you test this with the LinkedIn inspector for example, you see they target a different aspect ratio, as X does, as Facebook does, etc.:

image

Here is quickly made-up example of what we could do instead (not large enough in terms of pixels but with the correct aspect ratio):

grist-meta-example

2. About the title:

I'd argue "Welcome - Grist" is also not that friendly as the main title for sharing purposes and would say having the tagline in it might be better. When showing the website preview card, some platforms show the description, some do not.

So I'd say having Grist, the evolution of spreadsheet as the title, and changing the description to prevent too much duplication, for example with the tagline visible on getgrist.com I guess, A modern, open source spreadsheet that goes beyond the grid) might fit better?


Sidenote: when testing this with this tool: https://www.bannerbear.com/tools/twitter-card-preview-tool, Loading… is still shown instead of Welcome…. Not an official thing by any mean but maybe it shows a remaining issue?

@fflorent
Copy link
Collaborator Author

@manuhabitela Thanks for your feedback. As discussed, I take a look of what I can, but I feel like it should not block the review as it is better than what already exist. Still this should be a nice follow-up.

Sidenote: when testing this with this tool: https://www.bannerbear.com/tools/twitter-card-preview-tool, Loading… is still shown instead of Welcome…. Not an official thing by any mean but maybe it shows a remaining issue?

I don't know how this tool works. The only thing I notice is that the preview is not rendered on Twitter, at the contrary of say https://duckduckgo.com

I am trying something to fix this.

@manuhabitela
Copy link
Collaborator

You're totally right, my mistake for reporting that late :)

Copy link
Contributor

Deployed commit 3206c227534b46c5fccc6d16808f32b8c65edd60 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-11-15T16:02:49.258Z)

Copy link
Contributor

Deployed commit 332f060526f9c30fc6e4b1eed2cd629f9b42e69f as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-12-26T15:34:25.840Z)

Copy link
Contributor

Deployed commit 0e1727d66717b4862a41c63fd0e11f6e1f467307 as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2024-12-26T15:51:28.945Z)

Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for whittling out some parts that were hard to process. Have one more question, it may be fine.

app/server/lib/sendAppPage.ts Outdated Show resolved Hide resolved
@fflorent fflorent force-pushed the issue-1242-url-preview branch from c6cb821 to fdc7a36 Compare January 8, 2025 10:31
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Deployed commit fdc7a36b9a9ee0fdbf2d9e72622c72ca042a8d1a as https://grist-fflorent-grist-core-issue-1242-url-preview.fly.dev (until 2025-02-07T10:35:51.442Z)

Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fflorent !

@paulfitz
Copy link
Member

@berhalak landing is blocked for the changes you requested, are you satisfied?

@paulfitz paulfitz dismissed berhalak’s stale review January 16, 2025 14:45

Jarek is pretty sick at the moment, so lightening his plate. Looked at the review and everything seems addressed. Dismissing the review since it is blocking landing and I want to take the task of dealing with this PR off Jarek's plate..

@paulfitz paulfitz merged commit d06def9 into gristlabs:main Jan 16, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Launch preview deployment of this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URL Preview image and description of instances are missing
9 participants