bpatrik / pigallery2

A fast directory-first photo gallery website, with rich UI, optimized for running on low resource servers (especially on raspberry pi)
http://bpatrik.github.io/pigallery2/
MIT License
1.76k stars 202 forks source link

Title and thumbnail for share link #302

Open SlavikCA opened 3 years ago

SlavikCA commented 3 years ago

When user send a share link in messaging apps / social sites, they retrieve the page at that link and usually show TITLE and THUMBNAIL. Sometimes, they also show SNIPPET / DESCRIPTION.

Currently, shares generated by pigallery2 always show title "Loading..." and no thumbnails.

The feature request is to show more useful information via share links.

For example, here is how pigallery2 share link looks like in the messenger app (Viber): image

For comparison, here is how same messenger show Google Photo link: image

I thinks no images shown with pigallery2 links because of the progressive load. The initial page doesn't have any links to the image. However, it looks like that applicationTitle available on the initial request. So, it can be used for <title> instead of Loading... Even better, if the name of the folder would be used for <title> - it would be more informative.

I'm not sure, what it would take to show thumbnail. Perhaps, the thumbnail of the first image.

bpatrik commented 3 years ago

It is only possible show any photos if the link is not password protected, otherwise, we can only show a logo.

Any initial load customization should be done through server side templating.

Here are the template variables created: https://github.com/bpatrik/pigallery2/blob/e5cd8b67248c25197d179963d772a5ba028a9e7d/src/backend/routes/PublicRouter.ts#L62-L84

And they are used in the index.html. eg.: https://github.com/bpatrik/pigallery2/blob/e5cd8b67248c25197d179963d772a5ba028a9e7d/src/frontend/index.html#L4-L7 <title><%= Config.Client...applicationTitle %></title>

Feel free ti jump in and send a PR

Alternatively, we can implement a 'custom logo' config, where one can set up its own logo from one of the pictures in the gallery. I can give pointers to that too, but its more complicated.

I would assume that the normal logo would show up, maybe it requires a special HTML tag?