opds2: emit rel=alternate links for off-site identifier URLs#703
Merged
ajslater merged 1 commit intov1.11-performancefrom May 2, 2026
Merged
opds2: emit rel=alternate links for off-site identifier URLs#703ajslater merged 1 commit intov1.11-performancefrom
ajslater merged 1 commit intov1.11-performancefrom
Conversation
Per beville's follow-up on #700: identifier ``url`` values are off-site representations of the same publication and belong in publication.links as ``rel=alternate`` (e.g. {"rel": "alternate", "type": "text/html", "href": "https://comicvine.gamespot.com/...", "title": "View on ComicVine"}). The base view runs a per-comic query for the manifest path; the feed view overrides with a batched UNION query keyed by comic pk so a full feed page stays at one identifier query regardless of book count (matching the existing credits / subjects batching). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per beville's follow-up on #700: a comic's identifier URLs (ComicVine, Metron, etc.) are off-site representations of the same publication and belong in
publication.linksasrel=alternate. Mirrors the readino feed shape beville cited:```json
"links": [
{"rel": "self", "type": "application/divina+json", "href": "..."},
{"rel": "alternate", "type": "text/html", "href": "https://comicvine.gamespot.com/...", "title": "View on ComicVine"}
]
```
Now emitted on both the per-comic manifest endpoint and on each publication in the feed.
Implementation notes
OPDS2PublicationBaseView) runs a per-comic identifier query — used by the manifest path, which serves one book per request.OPDS2PublicationsView) overrides with a batched query keyed by comic pk, populated inget_publicationsbefore the per-publication loop. Mirrors the existing credits / subjects batching, so a full feed page stays at one identifier query regardless of book count.URLField(default="")means we filter.exclude(url="")rather than__isnull."View on <source>"when the identifier has a source,"View externally"otherwise.Test plan
make fix, ruff, basedpyright, complexity,make test-pythonall clean/opds/v2.0/c/<pk>/1on a comic with ComicVine/Metron identifiers and confirmlinkscontainsrel=alternateentries/opds/v2.0/<group>/<pks>/1(a feed page) and confirm each publication'slinkscontains its identifier alternates🤖 Generated with Claude Code