├── .gitignore ├── .vscode ├── extensions.json └── launch.json ├── README.md ├── astro.config.mjs ├── git-push.sh ├── lib └── api.js ├── package-lock.json ├── package.json ├── public └── favicon.svg ├── src ├── assets │ └── base.css ├── components │ ├── Card.astro │ └── Footer.astro ├── env.d.ts ├── layouts │ └── Layout.astro └── pages │ ├── dinos │ └── [slug].astro │ └── index.astro ├── tailwind.config.cjs └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | .output/ 4 | 5 | # dependencies 6 | node_modules/ 7 | 8 | # logs 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | pnpm-debug.log* 13 | 14 | 15 | # environment variables 16 | .env 17 | .env.production 18 | 19 | # macOS-specific files 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to [Astro](https://astro.build) 2 | 3 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) 4 | [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/s/github/withastro/astro/tree/latest/examples/basics) 5 | 6 | > 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! 7 | 8 | ![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) 9 | 10 | 11 | ## 🚀 Project Structure 12 | 13 | Inside of your Astro project, you'll see the following folders and files: 14 | 15 | ``` 16 | / 17 | ├── public/ 18 | │ └── favicon.svg 19 | ├── src/ 20 | │ ├── components/ 21 | │ │ └── Card.astro 22 | │ ├── layouts/ 23 | │ │ └── Layout.astro 24 | │ └── pages/ 25 | │ └── index.astro 26 | └── package.json 27 | ``` 28 | 29 | Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. 30 | 31 | There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. 32 | 33 | Any static assets, like images, can be placed in the `public/` directory. 34 | 35 | ## 🧞 Commands 36 | 37 | All commands are run from the root of the project, from a terminal: 38 | 39 | | Command | Action | 40 | | :--------------------- | :------------------------------------------------- | 41 | | `npm install` | Installs dependencies | 42 | | `npm run dev` | Starts local dev server at `localhost:3000` | 43 | | `npm run build` | Build your production site to `./dist/` | 44 | | `npm run preview` | Preview your build locally, before deploying | 45 | | `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` | 46 | | `npm run astro --help` | Get help using the Astro CLI | 47 | 48 | ## 👀 Want to learn more? 49 | 50 | Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). 51 | -------------------------------------------------------------------------------- /astro.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'astro/config'; 2 | 3 | // https://astro.build/config 4 | import tailwind from '@astrojs/tailwind'; 5 | 6 | // https://astro.build/config 7 | export default defineConfig({ 8 | integrations: [tailwind()], 9 | output: 'static', 10 | }); 11 | -------------------------------------------------------------------------------- /git-push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Enter the commit message: " 4 | read commit_message 5 | 6 | git add . 7 | git commit -am "$commit_message" 8 | git push origin main 9 | 10 | clear 11 | figlet "Done!" 12 | sleep 3 13 | clear 14 | -------------------------------------------------------------------------------- /lib/api.js: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | dotenv.config(); 3 | 4 | const API_URL = process.env.API_URL; 5 | 6 | // Gets post by API URL and given path 7 | export async function fetchAPI(path) { 8 | const res = await fetch(`${API_URL}${path}`); 9 | const json = await res.json(); 10 | 11 | return json; 12 | } 13 | 14 | export async function getPosts() { 15 | let posts = await fetchAPI('dinos?per_page=50&_embed'); 16 | return posts; 17 | } 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@and249/astro-wordpress", 3 | "type": "module", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "dev": "astro dev", 8 | "start": "astro dev", 9 | "build": "astro build", 10 | "preview": "astro preview", 11 | "astro": "astro" 12 | }, 13 | "dependencies": { 14 | "@astrojs/tailwind": "^2.1.3", 15 | "astro": "^1.6.11", 16 | "astro-icon": "^0.8.0", 17 | "daisyui": "^2.42.1", 18 | "dotenv": "^16.0.3", 19 | "tailwindcss": "^3.2.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/base.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | h2 { 6 | @apply text-3xl font-extrabold; 7 | } 8 | 9 | p { 10 | @apply mt-2; 11 | } 12 | 13 | /* Scroll bar */ 14 | ::-webkit-scrollbar { 15 | width: 12px; 16 | } 17 | ::-webkit-scrollbar-thumb { 18 | background: #42536b; 19 | } 20 | ::-webkit-scrollbar-thumb:hover { 21 | background: #34445a; 22 | } 23 | ::-webkit-scrollbar-track { 24 | background-color: #1f2937; 25 | } 26 | -------------------------------------------------------------------------------- /src/components/Card.astro: -------------------------------------------------------------------------------- 1 | --- 2 | export interface Props { 3 | post: {}; 4 | } 5 | 6 | let postExcerpt = (post) => { 7 | let content = post.content.rendered.split('.'); 8 | return `${content[0]}. ${content[1]}...`; 9 | }; 10 | const { post } = Astro.props; 11 | --- 12 | 13 |
14 |
15 | {post.title.rendered} 19 |
20 |
21 | 22 |

26 | 27 |

28 |

33 |

34 |
35 | -------------------------------------------------------------------------------- /src/components/Footer.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import { Icon } from 'astro-icon'; 3 | --- 4 | 5 | 51 | -------------------------------------------------------------------------------- /src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src/layouts/Layout.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import '~/assets/base.css'; 3 | import Footer from '~/components/Footer.astro'; 4 | export interface Props { 5 | title: string; 6 | } 7 | 8 | const { title } = Astro.props; 9 | --- 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {title} 19 | 23 | 24 | 25 | 30 | 31 |
32 | 33 |
34 | 35 |