Add CookiesNotice plugin with embedded HTML and CSS resources#9
Draft
Add CookiesNotice plugin with embedded HTML and CSS resources#9
Conversation
Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add cookies notice banner to website
Add CookiesNotice plugin
Mar 14, 2026
Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Copilot
AI
changed the title
Add CookiesNotice plugin
Add CookiesNotice plugin with embedded HTML template
Mar 14, 2026
Owner
|
@copilot extract the style into a css file |
Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Author
Done in 5537df8. The CSS rules have been moved from |
Copilot
AI
changed the title
Add CookiesNotice plugin with embedded HTML template
Add CookiesNotice plugin with embedded HTML and CSS resources
Mar 14, 2026
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.
Adds a
CookiesNoticeStatiq plugin that injects a dismissible cookie consent banner into rendered HTML pages, backed by madmurphy/cookies.js.New plugin (
src/Statiq.Plugins/CookiesNotice/)CookiesNoticeModule—ParallelModulethat post-processes.htmldestinations, loading a template and styles from embedded resources and injecting the rendered notice before</body>. Config values are HTML-encoded; cookie name is sanitized to safe characters.CookiesNoticeConfigurator— Wires the module into theContentpipelinePostProcessModulesautomatically.cookies-notice.html— Embedded resource containing the banner HTML/JS. Uses{{COOKIE_NAME}},{{COOKIE_MESSAGE}},{{COOKIE_BUTTON_TEXT}}, and{{COOKIE_STYLE}}as substitution tokens, keeping markup editable independently of C# code.cookies-notice.css— Embedded resource containing the banner styles, injected at runtime via the{{COOKIE_STYLE}}placeholder in the HTML template.Configuration (
appsettings.json)All keys are optional with sensible defaults:
{ "CookiesNoticeName": "cookiesAccepted", "CookiesNoticeMessage": "This website uses Google Analytics, and its cookies.", "CookiesNoticeButtonText": "Understood" }The banner is hidden on load;
cookies.js(jsDelivr CDN, pinned@1.0.0) checks for the named cookie onDOMContentLoadedand shows the banner if absent. Clicking the button sets a non-expiring cookie and hides the banner.Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.