docs: del samples

This commit is contained in:
Alex Tim 2022-06-12 11:10:55 +03:00
parent 7ab52d40db
commit 1041a12bc5
45 changed files with 0 additions and 632 deletions

View file

@ -1,18 +0,0 @@
# build output
dist/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

View file

@ -1,2 +0,0 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,6 +0,0 @@
{
"startCommand": "npm start",
"env": {
"ENABLE_CJS_IMPORTS": true
}
}

View file

@ -1,3 +0,0 @@
# Demo for @astrojs/sitemap integration
Play this demo [online](https://stackblitz.com/fork/github/withastro/astro/tree/main/examples/sitemap/advanced).

View file

@ -1,8 +0,0 @@
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import sitemapConfig from './sitemap.config';
// https://astro.build/config
export default defineConfig({
integrations: [sitemap(sitemapConfig)],
});

View file

@ -1,17 +0,0 @@
{
"name": "@example/sitemap-advanced",
"version": "0.0.1",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview"
},
"devDependencies": {
"astro": "workspace:*",
"@astrojs/sitemap": "workspace:*"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -1,11 +0,0 @@
{
"infiniteLoopProtection": true,
"hardReloadOnChange": false,
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"startScript": "start",
"node": "14"
}
}

View file

@ -1,28 +0,0 @@
const canonicalURL = 'https://example.com';
const sitemapConfig = {
filter: (page) => !/exclude-this/.test(page), // exclude pages from sitemap
customPages: [`${canonicalURL}/virtual-one.html`, `${canonicalURL}/virtual-two.html`],
canonicalURL,
createLinkInHead: true,
serialize(item) {
if (/special-page/.test(item.url)) {
item.changefreq = 'daily';
item.lastmod = new Date();
item.priority = 0.9;
}
return item;
},
// The integration creates a separate `sitemap-${i}.xml` file for each batch of 2, then adds this file to index - `sitemap-index.xml`.
entryLimit: 2, // default - 45000
// sitemap specific
changefreq: 'yearly',
lastmod: new Date('2019-12-31'),
priority: 0.4,
};
export default sitemapConfig;

View file

@ -1,14 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>404</title>
</head>
<body>
<h1>404</h1>
<p>Not Found</p>
<a href="/">Back to Home</a>
</body>
</html>

View file

@ -1,13 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Exclude this page</title>
</head>
<body>
<h1>Exclude this pade</h1>
<a href="/">Back to Home</a>
</body>
</html>

View file

@ -1,15 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Astro</title>
</head>
<body>
<h1>Astro</h1>
<a href="/second-page">Second page</a>
<a href="/special-page">Special page</a>
<a href="/exclude-this">Exclude this page</a>
</body>
</html>

View file

@ -1,13 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Second page</title>
</head>
<body>
<h1>Second page</h1>
<a href="/">Back to Home</a>
</body>
</html>

View file

@ -1,13 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Special page</title>
</head>
<body>
<h1>Special page</h1>
<a href="/">Back to Home</a>
</body>
</html>

View file

@ -1,15 +0,0 @@
{
"compilerOptions": {
// Enable top-level await, and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Add type definitions for our Vite runtime.
"types": ["vite/client"]
}
}

View file

@ -1,18 +0,0 @@
# build output
dist/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

View file

@ -1,2 +0,0 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,6 +0,0 @@
{
"startCommand": "npm start",
"env": {
"ENABLE_CJS_IMPORTS": true
}
}

View file

@ -1,3 +0,0 @@
# Demo for @astrojs/sitemap integration
Play this demo [online](https://stackblitz.com/fork/github/withastro/astro/tree/main/examples/sitemap/basic).

View file

@ -1,9 +0,0 @@
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
base: 'test',
integrations: [sitemap()],
});

View file

@ -1,17 +0,0 @@
{
"name": "@example/sitemap-basic",
"version": "0.0.1",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview"
},
"devDependencies": {
"astro": "workspace:*",
"@astrojs/sitemap": "workspace:*"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -1,11 +0,0 @@
{
"infiniteLoopProtection": true,
"hardReloadOnChange": false,
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"startScript": "start",
"node": "14"
}
}

View file

@ -1,12 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Astro</title>
</head>
<body>
<h1>Astro</h1>
</body>
</html>

View file

@ -1,13 +0,0 @@
---
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Second page</title>
</head>
<body>
<h1>Second page</h1>
<a href="/">Back to Home</a>
</body>
</html>

View file

@ -1,15 +0,0 @@
{
"compilerOptions": {
// Enable top-level await, and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Add type definitions for our Vite runtime.
"types": ["vite/client"]
}
}

View file

@ -1,18 +0,0 @@
# build output
dist/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

View file

@ -1,2 +0,0 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true

View file

@ -1,6 +0,0 @@
{
"startCommand": "npm start",
"env": {
"ENABLE_CJS_IMPORTS": true
}
}

View file

@ -1,9 +0,0 @@
# Demo for @astrojs/sitemap integration
This sample demonstrates the localization capabilities of `@astrojs/sitemap` integration.
The `i18n.mjs` file contains the locales basic info.
Its data is used for dynamic page generation, for language switch and as a source for the `@astrojs/sitemap` integration config.
Play this demo [online](https://stackblitz.com/fork/github/withastro/astro/tree/main/examples/sitemap/i18n).

View file

@ -1,10 +0,0 @@
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import sitemapConfig from './sitemap.config';
// https://astro.build/config
export default defineConfig({
site: 'https://another.com',
integrations: [sitemap(sitemapConfig)],
});

View file

@ -1,16 +0,0 @@
{
"name": "@example/sitemap-i18n",
"version": "0.0.1",
"private": true,
"license": "MIT",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview"
},
"devDependencies": {
"astro": "workspace:*",
"@astrojs/sitemap": "workspace:*"
}
}

View file

@ -1,11 +0,0 @@
{
"infiniteLoopProtection": true,
"hardReloadOnChange": false,
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"startScript": "start",
"node": "14"
}
}

View file

@ -1,15 +0,0 @@
import i18n from './src/i18n.js';
/** @type {import('astro-sitemap').SitemapOptions} */
const sitemapConfig = {
// added
i18n: {
defaultLocale: i18n.defaultLocale,
locales: Object.entries(i18n.locales).reduce((prev, [locale, { lang }]) => {
prev[locale] = lang;
return prev;
}, {}),
},
};
export default sitemapConfig;

View file

@ -1,45 +0,0 @@
---
import i18n from '../i18n';
export interface Props {
currentLocale: string;
}
const { currentLocale } = Astro.props as Props;
const pathname = new URL(Astro.request.url).pathname;
const getLink = (locale: string) => {
let path: string;
if (pathname === '/') {
path = '/';
} else {
const a = pathname.split('/');
if (i18n.locales[a[1]]) {
path = a.slice(2).join('/');
} else {
path = pathname;
}
}
if (!path.startsWith('/')) {
path = '/' + path;
}
return locale === i18n.defaultLocale ? path : `/${locale}${path}`;
};
---
<ul>
{
Object.keys(i18n.locales).map((locale) => (
<li>
{locale === currentLocale ? (
<span>
{locale}
</span>
) : (
<a href={getLink(locale)}>
{locale}
</a>
)}
</li>
))
}
</ul>

View file

@ -1,25 +0,0 @@
const i18n = {
defaultLocale: 'en',
locales: {
en: {
name: 'i18n test',
short_name: 'Test',
description: 'This is the application description',
lang: 'en-US',
},
es: {
name: 'Prueba i18n',
short_name: 'Prueba',
description: 'Esta es la descripción de la aplicación.',
lang: 'es-ES',
},
fr: {
name: 'Test i18n',
short_name: 'Test',
description: "Ceci est la description de l'application",
lang: 'fr-CA',
},
},
};
export default i18n;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

View file

@ -1,15 +0,0 @@
<svg width="1280" height="1280" viewBox="0 0 1280 1280" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M815.039 94.6439C824.758 106.709 829.714 122.99 839.626 155.553L1056.17 866.901C976.107 825.368 889.072 795.413 797.281 779.252L656.29 302.798C653.983 295.002 646.822 289.654 638.693 289.654C630.542 289.654 623.368 295.03 621.08 302.853L481.795 779.011C389.579 795.1 302.146 825.109 221.741 866.793L439.347 155.388L439.348 155.388C449.291 122.882 454.262 106.629 463.982 94.5853C472.562 83.9531 483.723 75.6958 496.4 70.6002C510.76 64.8284 527.756 64.8284 561.749 64.8284H717.174C751.212 64.8284 768.23 64.8284 782.603 70.6123C795.292 75.7184 806.459 83.9923 815.039 94.6439Z" fill="url(#paint0_linear_709_110)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M840.951 900.754C805.253 931.279 734.002 952.097 651.929 952.097C551.197 952.097 466.767 920.737 444.363 878.561C436.354 902.732 434.558 930.396 434.558 948.068C434.558 948.068 429.281 1034.84 489.636 1095.2C489.636 1063.86 515.042 1038.46 546.381 1038.46C600.097 1038.46 600.036 1085.32 599.987 1123.34C599.986 1124.48 599.984 1125.61 599.984 1126.73C599.984 1184.44 635.255 1233.91 685.416 1254.77C677.924 1239.36 673.721 1222.05 673.721 1203.77C673.721 1148.73 706.034 1128.23 743.588 1104.41L743.588 1104.41C773.469 1085.46 806.668 1064.41 829.548 1022.17C841.486 1000.13 848.265 974.893 848.265 948.068C848.265 931.573 845.702 915.676 840.951 900.754Z" fill="#FF5D01"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M840.951 900.754C805.253 931.279 734.002 952.097 651.929 952.097C551.197 952.097 466.767 920.737 444.363 878.561C436.354 902.732 434.558 930.396 434.558 948.068C434.558 948.068 429.281 1034.84 489.636 1095.2C489.636 1063.86 515.042 1038.46 546.381 1038.46C600.097 1038.46 600.036 1085.32 599.987 1123.34C599.986 1124.48 599.984 1125.61 599.984 1126.73C599.984 1184.44 635.255 1233.91 685.416 1254.77C677.924 1239.36 673.721 1222.05 673.721 1203.77C673.721 1148.73 706.034 1128.23 743.588 1104.41L743.588 1104.41C773.469 1085.46 806.668 1064.41 829.548 1022.17C841.486 1000.13 848.265 974.893 848.265 948.068C848.265 931.573 845.702 915.676 840.951 900.754Z" fill="url(#paint1_linear_709_110)"/>
<defs>
<linearGradient id="paint0_linear_709_110" x1="882.997" y1="27.1132" x2="638.955" y2="866.902" gradientUnits="userSpaceOnUse">
<stop stop-color="#000014"/>
<stop offset="1" stop-color="#150426"/>
</linearGradient>
<linearGradient id="paint1_linear_709_110" x1="1001.68" y1="652.45" x2="790.326" y2="1094.91" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF1639"/>
<stop offset="1" stop-color="#FF1639" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -1,17 +0,0 @@
---
import i18n from '../i18n';
const locale = i18n.defaultLocale;
const { lang } = i18n.locales[locale];
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>404</title>
</head>
<body>
<h1>404</h1>
<a href="/">&#x2302;</a>
</body>
</html>

View file

@ -1,32 +0,0 @@
---
import i18n from '../../i18n';
export async function getStaticPaths() {
const items = Object.entries(i18n.locales).filter(([locale]) => locale !== i18n.defaultLocale);
const paths = items.map(([locale, { lang }]) => ({
params: { locale },
props: { lang },
}));
return paths;
}
export interface Props {
lang: string;
}
const { locale } = Astro.params;
const { lang } = Astro.props as Props;
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>404</title>
</head>
<body>
<h1>404</h1>
<a href={`/${locale}`}>&#x2302;</a>
</body>
</html>

View file

@ -1,38 +0,0 @@
---
import i18n from '../../i18n';
import LanguageSwitch from '../../components/LanguageSwitch.astro';
export async function getStaticPaths() {
const items = Object.entries(i18n.locales).filter(([locale]) => locale !== i18n.defaultLocale);
const paths = items.map(([locale, { name, lang }]) => ({
params: { locale },
props: { name, lang },
}));
return paths;
}
export interface Props {
name: string;
description: string;
lang: string;
}
const { locale } = Astro.params;
const { name, description, lang } = Astro.props as Props;
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Astro {locale}</title>
</head>
<body>
<h1>Astro {locale}</h1>
<p>{name}</p>
<p>{description}</p>
<a href={'/' + locale + '/second-page'}>#2</a>
<LanguageSwitch currentLocale={locale + ''} />
</body>
</html>

View file

@ -1,36 +0,0 @@
---
import i18n from '../../i18n';
import LanguageSwitch from '../../components/LanguageSwitch.astro';
export async function getStaticPaths() {
const items = Object.entries(i18n.locales).filter(([locale]) => locale !== i18n.defaultLocale);
const paths = items.map(([locale, { name, lang }]) => ({
params: { locale },
props: { name, lang },
}));
return paths;
}
export interface Props {
name: string;
description: string;
lang: string;
}
const { locale } = Astro.params;
const { lang } = Astro.props as Props;
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>#2 {locale}</title>
</head>
<body>
<h1>#2 {locale}</h1>
<a href={'/' + locale}>&#x2302;</a>
<LanguageSwitch currentLocale={locale + ''} />
</body>
</html>

View file

@ -1,21 +0,0 @@
---
import i18n from '../i18n';
import LanguageSwitch from '../components/LanguageSwitch.astro';
const locale = i18n.defaultLocale;
const { lang, name, description } = i18n.locales[locale];
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Astro {locale}</title>
</head>
<body>
<h1>Astro {locale}</h1>
<p>{name}</p>
<p>{description}</p>
<a href="/second-page">#2</a>
<LanguageSwitch currentLocale={locale} />
</body>
</html>

View file

@ -1,19 +0,0 @@
---
import i18n from '../i18n';
import LanguageSwitch from '../components/LanguageSwitch.astro';
const locale = i18n.defaultLocale;
const { lang } = i18n.locales[locale];
---
<html lang={lang}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>#2 {locale}</title>
</head>
<body>
<h1>#2 {locale}</h1>
<a href="/">&#x2302;</a>
<LanguageSwitch currentLocale={locale} />
</body>
</html>

View file

@ -1,15 +0,0 @@
{
"compilerOptions": {
// Enable top-level await, and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Add type definitions for our Vite runtime.
"types": ["vite/client"]
}
}