custom domains: personalization#2961
Draft
Soxasora wants to merge 22 commits into
Draft
Conversation
DomainSeo handles title, tagline, favicon and og:image (social preview); SubTheme handles logo, colors (primary, secondary, link) and the default color scheme (system/dark/light)
…A_URL for uploaded brand assets - useDomainSeo allows custom SEO only if we're visiting a custom domain (and the territory has custom SEO)
…rst paint flickers - color utilities that normalize hex and rgb colors - buildSubThemeCss helper, overrides globals.scss and bootstrap colors
…th DomainContext, cleanup
…ing territory overrides in globals.scss
…d the correct url based on a req
Soxasora
commented
May 12, 2026
| // | ||
| // Accepts either an edge NextRequest, a Node IncomingMessage, or undefined. | ||
| // When called in the browser with no req, derives from window.location. | ||
| export function isSecureRequest (req) { |
Member
Author
There was a problem hiding this comment.
I moved isSecureRequest from /lib/auth.js to /lib/safe-url.js to decouple it from auth. Hope it's okay!
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.
schema and resolver not final, in dev
Description
Part of #1942, revives and rewrites #2202
Adds basic theming and SEO capabilities to territories with custom domains.
Theme and SEO data are then used to power dynamic RSS and PWA.
DomainSeo, tied to a custom domain
SubTheme, tied to a territory
This split allows us to re-use territory themes on
stacker.newsif in the future we decide so.Screenshots
Territory theme and Domain SEO forms
Custom domain with theme and seo
PWA installation (dynamic
site.webmanifestis recognized)Screen.Recording.2026-05-12.at.13.01.34.mov
Dynamic RSS with external territories support
Additional Context
The custom territory theme CSS is built by
buildSubThemeCSSand injected into_documentto ensure that the very first paint is already themed with the territory theme.buildSubThemeCssturnsSubThemeinto a string of CSS variable overrides:--bs-primary(-rgb)--theme-primary-text--bs-secondary(-rgb)--theme-secondary-text--theme-link(Hover)The
*-textvalues are a YIQ contrast pick (#000or#fff) computed bygetContrastTextColor(), because the foreground color on top of a brand color cannot be derived in CSS. Bootstrap handles color mixing and contrast calculations internally, forcing us to essentially re-do what it natively does in order to control the colors.The output CSS features a doubled selector, raising specificity so the overrides win against the scss
:rootdefaults.Bootstrap buttons'
button-variant()mixin bakes literal hex values into--bs-btn-bg, -bs-btn-hover-bg, ..., and the.btnbase class reads those values instead of--bs-primary.As a workaround, following Bootstrap's directions, we now:
.btn-primary, .btn-secondary, ...) so--bs-btn-bgreads the primary color and--bs-btn-colorreads--theme-primary-textcolor-mix, which is the runtime equivalent of scss'shade-color()--bs-btn-colorupdated earlier.SN default theme is exactly the same as before and now territory theme colors can affect buttons.
twbs/bootstrap#38788 (comment)
twbs/bootstrap#38170
Checklist
Are your changes backward compatible? Please answer below:
Yes!
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
6, did not test edge cases
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
in QA
Did you introduce any new environment variables? If so, call them out explicitly here:
n/a
Did you use AI for this? If so, how much did it assist you?
Yes, initial shape and working prototype. This PR takes inspiration from the vibe-shaped prototype.