Cache sponsor artwork, and let the empty slots be bought - #40
Merged
Merged
Conversation
The four images total 1.79MB and were refetched on every visit. Plug.Static only answers with a year-long immutable lifetime for a request carrying the asset digest, and the markup referenced the files as plain strings, so they came back with a bare cache-control: public. - Address the artwork through the static path helper, so the digest is present and a repeat visit spends nothing on it - Point the three unsold slots at a pre-filled enquiry email rather than leaving them inert, and add a "make an offer" line under the block - Build the mailto with rfc3986 encoding, because encode_www_form writes a space as "+" and mail clients paste that into the subject literally - Keep rel="sponsored" on the paid placement only; it describes paid outbound links and means nothing on a mailto This does not shrink the files. They are 1000x1000 and render at 250px, so about 90% of those bytes are still wasted. --- Pages affected: - [MCP Registry](https://ai.mcpharbor.dev/) — home page of the MCP server directory. - [GitHub MCP server](https://ai.mcpharbor.dev/servers/io.github.github/github-mcp-server) — a detail page carrying the sponsored slots. - [Browse MCP servers](https://ai.mcpharbor.dev/servers) — the searchable catalogue. Co-Authored-By: Claude Opus 5 <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.
Closes #39.
Why they were slow
Measured from production:
1.79 MB, at 64–340 KB/s. Three causes:
Plug.Staticonly answers withcache-control: public, max-age=31536000, immutablefor a request carrying the asset digest. A bare path gets a barecache-control: publicand noLast-Modified, so browsers fall back to heuristic caching and revalidate or refetch. Confirmed against production:/images/Book.png→cache-control: public;/images/Book.png?vsn=d→max-age=31536000, immutable. Fixed here.Also in here
The three unsold slots were not links at all. They now open a pre-filled enquiry:
Built with rfc3986 encoding rather than
URI.encode_www_form/1, which writes a space as+— mail clients paste that into the subject line literally. A "make an offer" line sits under the block for anyone who does not think to click the artwork.rel="sponsored"stays on the paid placement only; it describes paid outbound links and means nothing on amailto.87 tests pass, including one that pins the mailto encoding and one that pins the artwork going through the static path helper.
Pages affected:
🤖 Generated with Claude Code