Skip to content

Commit 315d4c0

Browse files
committed
setup template.
0 parents  commit 315d4c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+9746
-0
lines changed

.astro/types.d.ts

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.md': Promise<{
4+
Content: import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
remarkPluginFrontmatter: Record<string, any>;
7+
}>;
8+
}
9+
}
10+
11+
declare module 'astro:content' {
12+
export { z } from 'astro/zod';
13+
14+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
15+
16+
export type CollectionKey = keyof AnyEntryMap;
17+
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
18+
19+
export type ContentCollectionKey = keyof ContentEntryMap;
20+
export type DataCollectionKey = keyof DataEntryMap;
21+
22+
// This needs to be in sync with ImageMetadata
23+
export type ImageFunction = () => import('astro/zod').ZodObject<{
24+
src: import('astro/zod').ZodString;
25+
width: import('astro/zod').ZodNumber;
26+
height: import('astro/zod').ZodNumber;
27+
format: import('astro/zod').ZodUnion<
28+
[
29+
import('astro/zod').ZodLiteral<'png'>,
30+
import('astro/zod').ZodLiteral<'jpg'>,
31+
import('astro/zod').ZodLiteral<'jpeg'>,
32+
import('astro/zod').ZodLiteral<'tiff'>,
33+
import('astro/zod').ZodLiteral<'webp'>,
34+
import('astro/zod').ZodLiteral<'gif'>,
35+
import('astro/zod').ZodLiteral<'svg'>,
36+
import('astro/zod').ZodLiteral<'avif'>,
37+
]
38+
>;
39+
}>;
40+
41+
type BaseSchemaWithoutEffects =
42+
| import('astro/zod').AnyZodObject
43+
| import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]>
44+
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
45+
| import('astro/zod').ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>;
46+
47+
type BaseSchema =
48+
| BaseSchemaWithoutEffects
49+
| import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;
50+
51+
export type SchemaContext = { image: ImageFunction };
52+
53+
type DataCollectionConfig<S extends BaseSchema> = {
54+
type: 'data';
55+
schema?: S | ((context: SchemaContext) => S);
56+
};
57+
58+
type ContentCollectionConfig<S extends BaseSchema> = {
59+
type?: 'content';
60+
schema?: S | ((context: SchemaContext) => S);
61+
};
62+
63+
type CollectionConfig<S> = ContentCollectionConfig<S> | DataCollectionConfig<S>;
64+
65+
export function defineCollection<S extends BaseSchema>(
66+
input: CollectionConfig<S>
67+
): CollectionConfig<S>;
68+
69+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
70+
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
71+
ContentEntryMap[C]
72+
>['slug'];
73+
74+
export function getEntryBySlug<
75+
C extends keyof ContentEntryMap,
76+
E extends ValidContentEntrySlug<C> | (string & {}),
77+
>(
78+
collection: C,
79+
// Note that this has to accept a regular string too, for SSR
80+
entrySlug: E
81+
): E extends ValidContentEntrySlug<C>
82+
? Promise<CollectionEntry<C>>
83+
: Promise<CollectionEntry<C> | undefined>;
84+
85+
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
86+
collection: C,
87+
entryId: E
88+
): Promise<CollectionEntry<C>>;
89+
90+
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
91+
collection: C,
92+
filter?: (entry: CollectionEntry<C>) => entry is E
93+
): Promise<E[]>;
94+
export function getCollection<C extends keyof AnyEntryMap>(
95+
collection: C,
96+
filter?: (entry: CollectionEntry<C>) => unknown
97+
): Promise<CollectionEntry<C>[]>;
98+
99+
export function getEntry<
100+
C extends keyof ContentEntryMap,
101+
E extends ValidContentEntrySlug<C> | (string & {}),
102+
>(entry: {
103+
collection: C;
104+
slug: E;
105+
}): E extends ValidContentEntrySlug<C>
106+
? Promise<CollectionEntry<C>>
107+
: Promise<CollectionEntry<C> | undefined>;
108+
export function getEntry<
109+
C extends keyof DataEntryMap,
110+
E extends keyof DataEntryMap[C] | (string & {}),
111+
>(entry: {
112+
collection: C;
113+
id: E;
114+
}): E extends keyof DataEntryMap[C]
115+
? Promise<DataEntryMap[C][E]>
116+
: Promise<CollectionEntry<C> | undefined>;
117+
export function getEntry<
118+
C extends keyof ContentEntryMap,
119+
E extends ValidContentEntrySlug<C> | (string & {}),
120+
>(
121+
collection: C,
122+
slug: E
123+
): E extends ValidContentEntrySlug<C>
124+
? Promise<CollectionEntry<C>>
125+
: Promise<CollectionEntry<C> | undefined>;
126+
export function getEntry<
127+
C extends keyof DataEntryMap,
128+
E extends keyof DataEntryMap[C] | (string & {}),
129+
>(
130+
collection: C,
131+
id: E
132+
): E extends keyof DataEntryMap[C]
133+
? Promise<DataEntryMap[C][E]>
134+
: Promise<CollectionEntry<C> | undefined>;
135+
136+
/** Resolve an array of entry references from the same collection */
137+
export function getEntries<C extends keyof ContentEntryMap>(
138+
entries: {
139+
collection: C;
140+
slug: ValidContentEntrySlug<C>;
141+
}[]
142+
): Promise<CollectionEntry<C>[]>;
143+
export function getEntries<C extends keyof DataEntryMap>(
144+
entries: {
145+
collection: C;
146+
id: keyof DataEntryMap[C];
147+
}[]
148+
): Promise<CollectionEntry<C>[]>;
149+
150+
export function reference<C extends keyof AnyEntryMap>(
151+
collection: C
152+
): import('astro/zod').ZodEffects<
153+
import('astro/zod').ZodString,
154+
C extends keyof ContentEntryMap
155+
? {
156+
collection: C;
157+
slug: ValidContentEntrySlug<C>;
158+
}
159+
: {
160+
collection: C;
161+
id: keyof DataEntryMap[C];
162+
}
163+
>;
164+
// Allow generic `string` to avoid excessive type errors in the config
165+
// if `dev` is not running to update as you edit.
166+
// Invalid collection names will be caught at build time.
167+
export function reference<C extends string>(
168+
collection: C
169+
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
170+
171+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
172+
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
173+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
174+
>;
175+
176+
type ContentEntryMap = {
177+
178+
};
179+
180+
type DataEntryMap = {
181+
182+
};
183+
184+
type AnyEntryMap = ContentEntryMap & DataEntryMap;
185+
186+
type ContentConfig = never;
187+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*xsl linguist-vendored

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# build output
2+
dist/
3+
4+
# dependencies
5+
node_modules/
6+
7+
# logs
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
pnpm-debug.log*
12+
13+
14+
# environment variables
15+
.env
16+
.env.production
17+
18+
# macOS-specific files
19+
.DS_Store

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/**

.prettierrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"useTabs": true,
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"semi": true,
6+
"printWidth": 100,
7+
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"]
8+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Nicolas Dunke
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Astro & Tailwind CSS Starter Kit
2+
3+
## Features
4+
5+
Explore the Astro.js Personal Blog Template – a sleek and feature-rich platform for your personal blog:
6+
7+
- **Astro.js Powered**: Dynamic and efficient JavaScript-driven experience.
8+
- **Tailwind CSS Integration**: Ensures a stylish and responsive design.
9+
- **RSS Feed Support**: Keeps your audience updated effortlessly.
10+
- **Markdown Compatibility**: Streamlines content creation with easy formatting.
11+
- **Syntax Highlighting**: Enhances code snippet readability for tech enthusiasts.
12+
- **SEO-Optimized**: Includes a sitemap for optimal search engine visibility.
13+
- **Vercel Deployment:** preconfigured Vercel deployment & web analytics.
14+
- **Framework of your choice:** 100% Astro.js only template - choose your JS Framework (react preinstalled)
15+
16+
Unlock a seamless blend of aesthetics and functionality to share your unique voice with the world.
17+
18+
## Showcase
19+
20+
![showcase](/public/showcase.png 'AstroPress - Tech Blog Template')
21+
22+
## Template Integrations
23+
24+
- @astrojs/tailwind - https://docs.astro.build/en/guides/integrations-guide/tailwind/
25+
- @astrojs/react - https://docs.astro.build/en/guides/integrations-guide/react/
26+
- @astrojs/sitemap - https://docs.astro.build/en/guides/integrations-guide/sitemap/
27+
- @astrojs/rss - https://docs.astro.build/en/guides/rss/
28+
- @vercel/analytics - https://vercel.com/docs/analytics/
29+
- rehype-pretty-code - https://rehype-pretty-code.netlify.app/
30+
31+
## Template Structure
32+
33+
Inside of your Astro project, you'll see the following folders and files:
34+
35+
```
36+
/
37+
├── public/
38+
├── src/
39+
│ └── pages/
40+
│ └── index.astro
41+
└── package.json
42+
```
43+
44+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
45+
46+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
47+
48+
Any static assets, like images, can be placed in the `public/` directory.
49+
50+
## Commands
51+
52+
All commands are run from the root of the project, from a terminal:
53+
54+
| Command | Action |
55+
| :--------------------- | :----------------------------------------------- |
56+
| `npm install` | Installs dependencies |
57+
| `npm run dev` | Starts local dev server at `localhost:3000` |
58+
| `npm run build` | Build your production site to `./dist/` |
59+
| `npm run preview` | Preview your build locally, before deploying |
60+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
61+
| `npm run astro --help` | Get help using the Astro CLI |
62+
63+
## Want to learn more?
64+
65+
Feel free to check Astros [documentation](https://docs.astro.build)

astro.config.mjs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { defineConfig } from 'astro/config';
2+
import tailwind from '@astrojs/tailwind';
3+
import { remarkReadingTime } from './src/utils/readingTime';
4+
import rehypePrettyCode from 'rehype-pretty-code';
5+
import vercelStatic from '@astrojs/vercel/static';
6+
import react from '@astrojs/react';
7+
import sitemap from "@astrojs/sitemap";
8+
const options = {
9+
// Specify the theme to use or a custom theme json, in our case
10+
// it will be a moonlight-II theme from
11+
// https://github.com/atomiks/moonlight-vscode-theme/blob/master/src/moonlight-ii.json
12+
// Callbacks to customize the output of the nodes
13+
//theme: json,
14+
onVisitLine(node) {
15+
// Prevent lines from collapsing in `display: grid` mode, and
16+
// allow empty lines to be copy/pasted
17+
if (node.children.length === 0) {
18+
node.children = [{
19+
type: 'text',
20+
value: ' '
21+
}];
22+
}
23+
},
24+
onVisitHighlightedLine(node) {
25+
// Adding a class to the highlighted line
26+
node.properties.className = ['highlighted'];
27+
}
28+
};
29+
30+
31+
// https://astro.build/config
32+
export default defineConfig({
33+
site: 'https://astro-tech-blog-ten.vercel.app/',
34+
markdown: {
35+
syntaxHighlight: false,
36+
// Disable syntax built-in syntax hightlighting from astro
37+
rehypePlugins: [[rehypePrettyCode, options]],
38+
remarkPlugins: [remarkReadingTime]
39+
},
40+
integrations: [tailwind(), react(), sitemap()],
41+
output: 'static',
42+
adapter: vercelStatic({
43+
webAnalytics: {
44+
enabled: true
45+
}
46+
})
47+
});

0 commit comments

Comments
 (0)