diff options
author | 2022-04-03 16:02:57 -0300 | |
---|---|---|
committer | 2022-04-03 14:02:57 -0500 | |
commit | dc6e89f0a32952568def085a7c6eb79fae697303 (patch) | |
tree | 0312982227102e618f6f2f239f4bf25e32625f4c /examples | |
parent | dff89a0fa3d51d1473e8a19b000ba8a76261d060 (diff) | |
download | astro-dc6e89f0a32952568def085a7c6eb79fae697303.tar.gz astro-dc6e89f0a32952568def085a7c6eb79fae697303.tar.zst astro-dc6e89f0a32952568def085a7c6eb79fae697303.zip |
chore: updated examples to v0.26.0 (#2977)
* New script behavior
* Astro.request
* Reverted `deno` to `node`
* Updated subpath
Diffstat (limited to 'examples')
-rw-r--r-- | examples/blog-multiple-authors/src/pages/authors/[author].astro | 5 | ||||
-rw-r--r-- | examples/docs/src/components/HeadCommon.astro | 6 | ||||
-rw-r--r-- | examples/docs/src/components/LeftSidebar/LeftSidebar.astro | 2 | ||||
-rw-r--r-- | examples/docs/src/layouts/MainLayout.astro | 2 | ||||
-rw-r--r-- | examples/docs/src/pages/index.astro | 2 | ||||
-rw-r--r-- | examples/env-vars/src/pages/index.astro | 2 | ||||
-rw-r--r-- | examples/framework-alpine/src/pages/index.astro | 2 | ||||
-rw-r--r-- | examples/integrations-playground/src/pages/index.astro | 2 | ||||
-rw-r--r-- | examples/non-html-pages/src/pages/index.astro | 2 | ||||
-rw-r--r-- | examples/ssr/astro.config.mjs | 4 | ||||
-rw-r--r-- | examples/subpath/astro.config.mjs | 3 | ||||
-rw-r--r-- | examples/with-vite-plugin-pwa/src/pages/index.astro | 2 |
12 files changed, 17 insertions, 17 deletions
diff --git a/examples/blog-multiple-authors/src/pages/authors/[author].astro b/examples/blog-multiple-authors/src/pages/authors/[author].astro index c2ba49d39..bb1bc3aa2 100644 --- a/examples/blog-multiple-authors/src/pages/authors/[author].astro +++ b/examples/blog-multiple-authors/src/pages/authors/[author].astro @@ -11,19 +11,18 @@ export async function getStaticPaths() { } const { allPosts } = Astro.props; -const { params, canonicalURL } = Astro.request; const title = 'Don’s Blog'; const description = 'An example blog on Astro'; /** filter posts by author, sort by date */ -const posts = allPosts.filter((post) => post.frontmatter.author === params.author).sort((a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf()); +const posts = allPosts.filter((post) => post.frontmatter.author === Astro.params.author).sort((a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf()); const author = authorData[posts[0].frontmatter.author]; --- <html lang="en"> <head> <title>{title}</title> - <MainHead {title} {description} image={posts[0].frontmatter.image} canonicalURL={canonicalURL.toString()} /> + <MainHead {title} {description} image={posts[0].frontmatter.image} canonicalURL={Astro.canonicalURL.toString()} /> <style lang="scss"> .title { diff --git a/examples/docs/src/components/HeadCommon.astro b/examples/docs/src/components/HeadCommon.astro index 21504cf89..b6a74cdc6 100644 --- a/examples/docs/src/components/HeadCommon.astro +++ b/examples/docs/src/components/HeadCommon.astro @@ -18,10 +18,10 @@ import '../styles/index.css'; <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital@0;1&display=swap" rel="stylesheet" /> <!-- Scrollable a11y code helper --> -<script type="module" src="/make-scrollable-code-focusable.js"></script> +<script src="/make-scrollable-code-focusable.js" is:inline></script> <!-- This is intentionally inlined to avoid FOUC --> -<script> +<script is:inline> const root = document.documentElement; const theme = localStorage.getItem('theme'); if (theme === 'dark' || (!theme && window.matchMedia('(prefers-color-scheme: dark)').matches)) { @@ -32,7 +32,7 @@ import '../styles/index.css'; </script> <!-- Global site tag (gtag.js) - Google Analytics --> -<!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-TEL60V1WM9"></script> +<!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-TEL60V1WM9" is:inline></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} diff --git a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro b/examples/docs/src/components/LeftSidebar/LeftSidebar.astro index 99a03213d..107423385 100644 --- a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro +++ b/examples/docs/src/components/LeftSidebar/LeftSidebar.astro @@ -43,7 +43,7 @@ const sidebarSections = SIDEBAR[langCode].reduce((col, item, i) => { </ul> </nav> -<script> +<script is:inline> window.addEventListener('DOMContentLoaded', (event) => { var target = document.querySelector('[aria-current="page"]'); if (target && target.offsetTop > window.innerHeight - 100) { diff --git a/examples/docs/src/layouts/MainLayout.astro b/examples/docs/src/layouts/MainLayout.astro index 8c46278fe..9939592a9 100644 --- a/examples/docs/src/layouts/MainLayout.astro +++ b/examples/docs/src/layouts/MainLayout.astro @@ -9,7 +9,7 @@ import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; import * as CONFIG from '../config'; const { content = {} } = Astro.props; -const currentPage = Astro.request.url.pathname; +const currentPage = new URL(Astro.request.url).pathname; const currentFile = `src/pages${currentPage.replace(/\/$/, '')}.md`; const githubEditUrl = CONFIG.GITHUB_EDIT_URL && CONFIG.GITHUB_EDIT_URL + currentFile; --- diff --git a/examples/docs/src/pages/index.astro b/examples/docs/src/pages/index.astro index 4ce893162..bce06972f 100644 --- a/examples/docs/src/pages/index.astro +++ b/examples/docs/src/pages/index.astro @@ -1,4 +1,4 @@ -<script> +<script is:inline> // Redirect your homepage to the first page of documentation. // If you have a landing page, remove this script and add it here! window.location.pathname = `/en/introduction`; diff --git a/examples/env-vars/src/pages/index.astro b/examples/env-vars/src/pages/index.astro index 0d19b9a46..b48fac193 100644 --- a/examples/env-vars/src/pages/index.astro +++ b/examples/env-vars/src/pages/index.astro @@ -16,6 +16,6 @@ console.log({ SSR, PUBLIC_SOME_KEY }); </head> <body> <h1>Hello, Environment Variables!</h1> - <script type="module" src="/src/scripts/client.ts"></script> + <script src="/src/scripts/client.ts"></script> </body> </html> diff --git a/examples/framework-alpine/src/pages/index.astro b/examples/framework-alpine/src/pages/index.astro index c72e41187..3626ed604 100644 --- a/examples/framework-alpine/src/pages/index.astro +++ b/examples/framework-alpine/src/pages/index.astro @@ -23,7 +23,7 @@ import Counter from '../components/Counter.astro'; </style> <!-- Be sure to include AlpineJS --> - <script src="//unpkg.com/alpinejs" defer></script> + <script src="//unpkg.com/alpinejs" defer is:inline></script> </head> <body> <main> diff --git a/examples/integrations-playground/src/pages/index.astro b/examples/integrations-playground/src/pages/index.astro index 677026072..2ee717d6a 100644 --- a/examples/integrations-playground/src/pages/index.astro +++ b/examples/integrations-playground/src/pages/index.astro @@ -38,7 +38,7 @@ import '../components/Counter.js'; console.log('end partytown blocking script') </script> - <script> + <script is:inline> setInterval(() => { const randomColor = Math.floor(Math.random()*16777215).toString(16); document.querySelector('.partytown-status').style.color = "#" + randomColor; diff --git a/examples/non-html-pages/src/pages/index.astro b/examples/non-html-pages/src/pages/index.astro index accde929c..9abb797e4 100644 --- a/examples/non-html-pages/src/pages/index.astro +++ b/examples/non-html-pages/src/pages/index.astro @@ -7,7 +7,7 @@ </head> <body> <h1 id="result">Loading...</h1> - <script type="module"> + <script> // Non-HTML files will be included in your final build, so you // can fetch them directly in the browser. const response = await fetch(`/about.json`); diff --git a/examples/ssr/astro.config.mjs b/examples/ssr/astro.config.mjs index ddb265905..5794b07f1 100644 --- a/examples/ssr/astro.config.mjs +++ b/examples/ssr/astro.config.mjs @@ -1,9 +1,9 @@ import { defineConfig } from 'astro/config'; import svelte from '@astrojs/svelte'; -import deno from '@astrojs/deno'; +import node from '@astrojs/node'; // https://astro.build/config export default defineConfig({ - adapter: deno(), + adapter: node(), integrations: [svelte()], }); diff --git a/examples/subpath/astro.config.mjs b/examples/subpath/astro.config.mjs index 02b050efc..d76e5ffb5 100644 --- a/examples/subpath/astro.config.mjs +++ b/examples/subpath/astro.config.mjs @@ -4,5 +4,6 @@ import react from '@astrojs/react'; // https://astro.build/config export default defineConfig({ integrations: [react()], - site: 'http://example.com/blog', + site: 'http://example.com', + base: '/blog', }); diff --git a/examples/with-vite-plugin-pwa/src/pages/index.astro b/examples/with-vite-plugin-pwa/src/pages/index.astro index 19ca25700..6214033dd 100644 --- a/examples/with-vite-plugin-pwa/src/pages/index.astro +++ b/examples/with-vite-plugin-pwa/src/pages/index.astro @@ -11,6 +11,6 @@ <body> <h1>Welcome to <a href="https://astro.build/">Astro</a></h1> - <script src="/src/index.ts" type="module" hoist></script> + <script src="/src/index.ts"></script> </body> </html> |