Closed codeceptsDE closed 3 months ago
The issue seems to be caused by this pull request https://github.com/immich-app/immich/pull/5635 adding incorrect to meta tags into the document. The meta tags in web/src/routes/+layout.svelte
seems to have existed before above PR.
Can any maintainers provide some insight if it is still needed? Since the solution seem to be just reverting it.
The meta tags need to come in the raw html response itself, directly from the server. Link unfurlers don't always run a web browser, execute javascript, and wait for the page to render before looking for the tags. They are added in svelte client-side, which is the reason why they were added server-side instead.
The meta tags need to come in the raw html response itself, directly from the server. Link unfurlers don't always run a web browser, execute javascript, and wait for the page to render before looking for the tags. They are added in svelte client-side, which is the reason why they were added server-side instead.
Oh I see, I thought the server uses Svelte SSR
Yeah, we currently bundle the svelte app as a static build in the immich-server
container.
Wrong asset count aside, do you think we should de-duplicate the meta tags?
Currently the locally run server (npm run dev
) only display client renderred meta tags. It can be modified to render only if SSR tags don't already exist.
I don't think we need the client-side tags at all actually. We can probably comment them out.
The only caveat here is we might change from the static adapter to the node adapter and use the exported handler in the future. In that case we would no longer need the custom server implementation and the current svelte implementation would work as expected.
The bug
When sharing an album via link, the (opengraph/...) preview displays "0 shared photos & videos" as description, irrespective of the actual count. The wrong description is gathered from the duplicated
<meta>
tags in the share page's<head>
. There, the<meta name="description"
,<meta propterty="og:
and<meta name=twitter:
tags appear twice: once with count 0, and at the end with the correct count. In fact, the<meta name="description"
even appears a third time. The displayed count in the actual page body is correct.The OS that Immich Server is running on
Docker on Debian
Version of Immich Server
v1.101.0
Version of Immich Mobile App
-
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
Additional information
The initially sent
<head>
looks like this, and (only) contains the description mentioning 0 photos:initial header
``` ```After all scripts have run, the following lines get appended at the end (whitespace by me). They do contain the correct count.
additional html header content after scripts
``` link rel="modulepreload" as="script" crossorigin="" href="https://redacted.domain/_app/immutable/chunks/mdi.BV22mFDw.js">The relevant sections are:
before scripts (beginning of header):
and after (end of header):
Note how
<meta name="description"
even appears a third time.Thoughts on a possible fix
I am unsure how different apps deal with metadata information and js. I suspect it may not be enough if the metadata tags are replaced once the scripts have loaded (instead of accidentally duplicating), because not all apps may wait until js has run. But if it's possible to load the thumbnail on the first request, so should be the photo count, I would assume.