generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 195
feat: add back site scripts #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| /** | ||
| * AWS legal footer links and copyright notice. | ||
| * Used in PageFrame.astro (docs pages) and index.astro (landing page). | ||
| */ | ||
| --- | ||
|
|
||
| <p class="copyright"> | ||
| <a href="https://aws.amazon.com/privacy" target="_blank" rel="noopener noreferrer">Privacy</a> | ||
| | | ||
| <a href="https://aws.amazon.com/terms" target="_blank" rel="noopener noreferrer">Site Terms</a> | ||
| | | ||
| <a href="#" id="cookie-preferences">Cookie Preferences</a> | ||
| | | ||
| © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. | ||
| </p> | ||
|
|
||
| <style> | ||
| .copyright { | ||
| font-size: var(--sl-text-sm); | ||
| color: var(--sl-color-gray-3); | ||
| margin: 0; | ||
| } | ||
|
|
||
| .copyright a { | ||
| color: var(--sl-color-gray-3); | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .copyright a:hover { | ||
| color: var(--sl-color-white); | ||
| text-decoration: underline; | ||
| } | ||
| </style> | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| /** | ||
| * AWS Shortbread cookie consent and Analytics WebSDK initialization. | ||
| * Included in both Head.astro (docs pages) and LandingLayout.astro (index page). | ||
| */ | ||
| --- | ||
|
|
||
| <link rel="stylesheet" href="https://prod.assets.shortbread.aws.dev/shortbread.css" /> | ||
| <script is:inline src="https://prod.assets.shortbread.aws.dev/shortbread.js"></script> | ||
| <script is:inline> | ||
| /** | ||
| * Shortbread Cookie Consent and AWS Analytics WebSDK Initialization | ||
| * CRITICAL: Site must operate even if Shortbread is unavailable. | ||
| */ | ||
| ;(function () { | ||
| 'use strict' | ||
|
|
||
| const hostname = window.location.hostname | ||
| const isLocal = hostname === 'localhost' || hostname === '127.0.0.1' | ||
| const isCloudFrontPreview = hostname === 'd3ehv1nix5p99z.cloudfront.net' | ||
| const isProduction = hostname.endsWith('.strandsagents.com') || hostname === 'strandsagents.com' | ||
|
|
||
| const domain = isLocal || isCloudFrontPreview ? hostname : '.strandsagents.com' | ||
|
|
||
| let webSdkStage, webSdkDomain | ||
| if (isProduction) { | ||
| webSdkStage = 'prod' | ||
| webSdkDomain = 'https://d0.m.awsstatic.com' | ||
| } else if (isLocal) { | ||
| webSdkStage = 'alpha' | ||
| webSdkDomain = 'https://da0.m.awsstatic.com' | ||
| } else { | ||
| webSdkStage = 'gamma' | ||
| webSdkDomain = 'https://dg0.m.awsstatic.com' | ||
| } | ||
|
|
||
| if (typeof AWSCShortbread === 'undefined') { | ||
| console.warn('Shortbread unavailable. Using essential cookies only.') | ||
| return | ||
| } | ||
|
|
||
| try { | ||
| const existingShortbreadEl = document.getElementById('awsccc-sb-ux-c') | ||
| if (existingShortbreadEl) existingShortbreadEl.remove() | ||
|
|
||
| const shortbread = AWSCShortbread({ | ||
| domain, | ||
| registry: { | ||
| GitHubRepoCache: { category: 'essential' }, | ||
| }, | ||
| language: AWSCShortbread.Locale?.getLocaleIdShortbread( | ||
| AWSCShortbread.Locale.getCurrentLocale() | ||
| ), | ||
| }) | ||
|
|
||
| shortbread.checkForCookieConsent() | ||
| window.strandsShortbread = shortbread | ||
|
|
||
| document.addEventListener('click', function (e) { | ||
| if (e.target.id === 'cookie-preferences') { | ||
| e.preventDefault() | ||
| shortbread.customizeCookies() | ||
| } | ||
| }) | ||
|
|
||
| loadWebSDK(webSdkStage, webSdkDomain) | ||
| } catch (error) { | ||
| console.error('Shortbread error:', error) | ||
| } | ||
|
|
||
| function loadWebSDK(stage, sdkDomain) { | ||
| try { | ||
| const script = document.createElement('script') | ||
| script.type = 'module' | ||
| script.id = 'awsm-csa' | ||
| script.src = sdkDomain + '/awsm-acslibs/1.0.0/bundle/slim/wsdk.js' | ||
| script.setAttribute('data-awsm-csa-meta', JSON.stringify({ env: { stage } })) | ||
| document.head.appendChild(script) | ||
| } catch (error) { | ||
| console.error('WebSDK loading error:', error) | ||
| } | ||
| } | ||
| })() | ||
| </script> |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| --- | ||
| /** | ||
| * PageFrame override — adds a full-width site footer with copyright below the main content. | ||
| * All other markup and styles are identical to Starlight's default PageFrame. | ||
| */ | ||
| import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle' | ||
| import Copyright from '../Copyright.astro' | ||
|
|
||
| const { hasSidebar } = Astro.locals.starlightRoute | ||
| --- | ||
|
|
||
| <div class="page sl-flex"> | ||
| <header class="header"><slot name="header" /></header> | ||
| {hasSidebar && ( | ||
| <nav class="sidebar print:hidden" aria-label={Astro.locals.t('sidebarNav.accessibleLabel')}> | ||
| <MobileMenuToggle /> | ||
| <div id="starlight__sidebar" class="sidebar-pane"> | ||
| <div class="sidebar-content sl-flex"> | ||
| <slot name="sidebar" /> | ||
| </div> | ||
| </div> | ||
| </nav> | ||
| )} | ||
| <div class="main-frame"><slot /></div> | ||
| <footer class="site-footer print:hidden"> | ||
| <Copyright /> | ||
| </footer> | ||
| </div> | ||
|
|
||
| <style> | ||
| @layer starlight.core { | ||
| .page { | ||
| flex-direction: column; | ||
| min-height: 100vh; | ||
| } | ||
|
|
||
| .header { | ||
| z-index: var(--sl-z-index-navbar); | ||
| position: fixed; | ||
| inset-inline-start: 0; | ||
| inset-block-start: 0; | ||
| width: 100%; | ||
| height: var(--sl-nav-height); | ||
| border-bottom: 1px solid var(--sl-color-hairline-shade); | ||
| padding: var(--sl-nav-pad-y) var(--sl-nav-pad-x); | ||
| padding-inline-end: var(--sl-nav-pad-x); | ||
| background-color: var(--sl-color-bg-nav); | ||
| } | ||
|
|
||
| :global([data-has-sidebar]) .header { | ||
| padding-inline-end: calc( | ||
| var(--sl-nav-gap) + var(--sl-nav-pad-x) + var(--sl-menu-button-size) | ||
| ); | ||
| } | ||
|
|
||
| .sidebar-pane { | ||
| visibility: var(--sl-sidebar-visibility, hidden); | ||
| position: fixed; | ||
| z-index: var(--sl-z-index-menu); | ||
| inset-block: var(--sl-nav-height) 0; | ||
| inset-inline-start: 0; | ||
| width: 100%; | ||
| background-color: var(--sl-color-black); | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| :global([aria-expanded='true']) ~ .sidebar-pane { | ||
| --sl-sidebar-visibility: visible; | ||
| } | ||
|
|
||
| .sidebar-content { | ||
| height: 100%; | ||
| min-height: max-content; | ||
| padding: 1rem var(--sl-sidebar-pad-x) 0; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| } | ||
|
|
||
| @media (min-width: 50rem) { | ||
| .sidebar-content::after { | ||
| content: ''; | ||
| padding-bottom: 1px; | ||
| } | ||
| } | ||
|
|
||
| .main-frame { | ||
| padding-top: calc(var(--sl-nav-height) + var(--sl-mobile-toc-height)); | ||
| padding-inline-start: var(--sl-content-inline-start); | ||
| flex: 1; | ||
| } | ||
|
|
||
| @media (min-width: 50rem) { | ||
| :global([data-has-sidebar]) .header { | ||
| padding-inline-end: var(--sl-nav-pad-x); | ||
| } | ||
| .sidebar-pane { | ||
| --sl-sidebar-visibility: visible; | ||
| width: var(--sl-sidebar-width); | ||
| background-color: var(--sl-color-bg-sidebar); | ||
| border-inline-end: 1px solid var(--sl-color-hairline-shade); | ||
| } | ||
| } | ||
|
|
||
| .site-footer { | ||
| padding-block: 1.25rem; | ||
| padding-inline-end: var(--sl-nav-pad-x); | ||
| border-top: 1px solid var(--sl-color-hairline-shade); | ||
| background-color: var(--sl-color-bg-nav); | ||
| text-align: left; | ||
| padding-inline-start: calc(var(--sl-content-inline-start, 0em) + var(--sl-nav-pad-x)); | ||
| } | ||
| } | ||
| </style> |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.