Compare commits
1 Commits
main
...
d45dec0ba5
| Author | SHA1 | Date | |
|---|---|---|---|
|
d45dec0ba5
|
@@ -3,7 +3,7 @@ name: release-image-gitea
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 3.*
|
- 2.*
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -14,34 +14,36 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Bun
|
- name: Set up pnpm
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
bun-version: 1.3.10
|
version: 10.x
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
- name: Cache Astro Build Cache
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.astro
|
node_modules/.cache
|
||||||
node_modules/.vite
|
.astro/cache
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-astro-
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: bun run lint
|
run: pnpm lint
|
||||||
|
|
||||||
- name: Build Project
|
- name: Build Project
|
||||||
run: bun run build
|
run: pnpm build
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-js
|
runs-on: ubuntu-js
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: release-image-harbor
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 3.*
|
- 2.*
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -14,34 +14,36 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Bun
|
- name: Set up pnpm
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
bun-version: 1.3.10
|
version: 10.x
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
- name: Cache Astro Build Cache
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.astro
|
node_modules/.cache
|
||||||
node_modules/.vite
|
.astro/cache
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-astro-
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: bun run lint
|
run: pnpm lint
|
||||||
|
|
||||||
- name: Build Project
|
- name: Build Project
|
||||||
run: bun run build
|
run: pnpm build
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-js
|
runs-on: ubuntu-js
|
||||||
|
|||||||
@@ -16,34 +16,36 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Bun
|
- name: Set up pnpm
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
bun-version: 1.3.10
|
version: 10.x
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
- name: Cache Astro Build Cache
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.astro
|
node_modules/.cache
|
||||||
node_modules/.vite
|
.astro/cache
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
key: ${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-astro-
|
${{ runner.os }}-astro-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
|
${{ runner.os }}-astro-cache-
|
||||||
|
|
||||||
- name: Lint Code
|
- name: Lint Code
|
||||||
run: bun run lint
|
run: pnpm lint
|
||||||
|
|
||||||
- name: Build Project
|
- name: Build Project
|
||||||
run: bun run build
|
run: pnpm build
|
||||||
|
|
||||||
- name: ntfy Failed
|
- name: ntfy Failed
|
||||||
uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,6 +10,8 @@ node_modules/
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
.env
|
.env
|
||||||
|
|||||||
3
.npmrc
Normal file
3
.npmrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
registry=https://registry.npmjs.org/
|
||||||
|
engine-strict=true
|
||||||
|
save-exact=true
|
||||||
26
Dockerfile
26
Dockerfile
@@ -1,30 +1,32 @@
|
|||||||
FROM dhi.io/bun:1.3.10-debian13-dev AS builder
|
FROM docker.io/node:24.14.0-alpine AS builder
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package.json bun.lock ./
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
FROM builder AS prod-deps
|
FROM builder AS prod-deps
|
||||||
RUN --mount=type=cache,id=bun,target=/root/.bun/install/cache \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||||
bun install --production --frozen-lockfile
|
|
||||||
|
|
||||||
FROM builder AS build-deps
|
FROM prod-deps AS build-deps
|
||||||
RUN --mount=type=cache,id=bun,target=/root/.bun/install/cache \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
bun install --frozen-lockfile
|
|
||||||
|
|
||||||
FROM build-deps AS build
|
FROM build-deps AS build
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN bun run build
|
RUN pnpm run build
|
||||||
|
|
||||||
FROM dhi.io/bun:1.3.10-alpine3.22 AS runtime
|
FROM dhi.io/node:24.14.0 AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
|
|
||||||
LABEL version="3.1.0"
|
LABEL version="2.25.0"
|
||||||
LABEL description="Astro based personal website"
|
LABEL description="Astro based personal website"
|
||||||
|
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
ENV PORT=4321
|
ENV PORT=4321
|
||||||
|
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
CMD ["bun", "run", "./dist/server/entry.mjs"]
|
CMD ["node", "./dist/server/entry.mjs"]
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ Personal site used for information about myself and blog.
|
|||||||
|
|
||||||
With dependencies installed, you can utilize the following npm scripts to manage your project's development lifecycle:
|
With dependencies installed, you can utilize the following npm scripts to manage your project's development lifecycle:
|
||||||
|
|
||||||
- `bun run build`: Bundles your site into static files for production.
|
- `pnpm build`: Bundles your site into static files for production.
|
||||||
- `bun run dev`: Starts a local development server with hot reloading enabled.
|
- `pnpm dev`: Starts a local development server with hot reloading enabled.
|
||||||
|
- `pnpm preview`: Serves your build output locally for preview before deployment.
|
||||||
|
|
||||||
For detailed help with Astro CLI commands, visit [Astro's documentation](https://docs.astro.build/en/reference/cli-reference/).
|
For detailed help with Astro CLI commands, visit [Astro's documentation](https://docs.astro.build/en/reference/cli-reference/).
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
import node from '@astrojs/node';
|
import node from '@astrojs/node';
|
||||||
|
import partytown from '@astrojs/partytown';
|
||||||
import react from '@astrojs/react';
|
import react from '@astrojs/react';
|
||||||
import sitemap from '@astrojs/sitemap';
|
import sitemap from '@astrojs/sitemap';
|
||||||
|
|
||||||
@@ -13,8 +14,6 @@ import { getSiteURL } from './src/support/url';
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: getSiteURL(),
|
site: getSiteURL(),
|
||||||
|
|
||||||
security: { csp: true },
|
|
||||||
|
|
||||||
image: {
|
image: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{ protocol: 'https', hostname: '*.alexlebens.net' },
|
{ protocol: 'https', hostname: '*.alexlebens.net' },
|
||||||
@@ -29,6 +28,7 @@ export default defineConfig({
|
|||||||
prefetch: true,
|
prefetch: true,
|
||||||
|
|
||||||
integrations: [
|
integrations: [
|
||||||
|
partytown(),
|
||||||
react(),
|
react(),
|
||||||
sitemap(),
|
sitemap(),
|
||||||
icon({
|
icon({
|
||||||
|
|||||||
19
package.json
19
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "site-profile",
|
"name": "site-profile",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.1.0",
|
"version": "2.25.0",
|
||||||
"homepage": "https://www.alexlebens.dev",
|
"homepage": "https://www.alexlebens.dev",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
||||||
@@ -27,25 +27,25 @@
|
|||||||
"lint:fix": "eslint --fix \"src/**/*.{js,ts,jsx,tsx,astro}\""
|
"lint:fix": "eslint --fix \"src/**/*.{js,ts,jsx,tsx,astro}\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.7",
|
"@astrojs/check": "^0.9.6",
|
||||||
"@astrojs/node": "^10.0.0",
|
"@astrojs/node": "^10.0.0",
|
||||||
|
"@astrojs/partytown": "^2.1.4",
|
||||||
"@astrojs/react": "^5.0.0",
|
"@astrojs/react": "^5.0.0",
|
||||||
"@astrojs/rss": "^4.0.17",
|
"@astrojs/rss": "^4.0.15",
|
||||||
"@astrojs/sitemap": "^3.7.1",
|
"@astrojs/sitemap": "^3.7.0",
|
||||||
"@directus/sdk": "^21.2.0",
|
"@directus/sdk": "^21.2.0",
|
||||||
"@giscus/react": "^3.1.0",
|
"@giscus/react": "^3.1.0",
|
||||||
"@iconify-json/mdi": "^1.2.3",
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@iconify-json/pajamas": "^1.2.15",
|
"@iconify-json/pajamas": "^1.2.15",
|
||||||
"@iconify-json/simple-icons": "^1.2.73",
|
"@iconify-json/simple-icons": "^1.2.72",
|
||||||
"@playform/compress": "^0.2.1",
|
"@playform/compress": "^0.2.1",
|
||||||
"@swup/astro": "^1.8.0",
|
"@swup/astro": "^1.8.0",
|
||||||
"@tailwindcss/postcss": "^4.2.1",
|
"@tailwindcss/postcss": "^4.2.1",
|
||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
"@types/react": "^19.2.14",
|
"@types/react": "^19.2.14",
|
||||||
"@types/unist": "^3.0.3",
|
"@types/unist": "^3.0.3",
|
||||||
"astro": "^6.0.2",
|
"astro": "^6.0.0",
|
||||||
"astro-icon": "^1.1.5",
|
"astro-icon": "^1.1.5",
|
||||||
"markdown-it": "^14.1.1",
|
|
||||||
"marked": "^17.0.4",
|
"marked": "^17.0.4",
|
||||||
"marked-shiki": "^1.2.1",
|
"marked-shiki": "^1.2.1",
|
||||||
"mdast-util-to-string": "^4.0.0",
|
"mdast-util-to-string": "^4.0.0",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"reading-time": "^1.5.0",
|
"reading-time": "^1.5.0",
|
||||||
"sharp": "^0.34.5",
|
"sharp": "^0.34.5",
|
||||||
"sharp-ico": "^0.1.5",
|
"sharp-ico": "^0.1.5",
|
||||||
"shiki": "^4.0.2",
|
"shiki": "^4.0.1",
|
||||||
"tailwindcss": "^4.2.1",
|
"tailwindcss": "^4.2.1",
|
||||||
"ultrahtml": "^1.6.0"
|
"ultrahtml": "^1.6.0"
|
||||||
},
|
},
|
||||||
@@ -64,7 +64,6 @@
|
|||||||
"@eslint-react/eslint-plugin": "^2.13.0",
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/markdown-it": "^14.1.2",
|
|
||||||
"eslint": "^10.0.3",
|
"eslint": "^10.0.3",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-astro": "^1.6.0",
|
"eslint-plugin-astro": "^1.6.0",
|
||||||
@@ -77,6 +76,6 @@
|
|||||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||||
"timeago.js": "^4.0.2",
|
"timeago.js": "^4.0.2",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.57.0"
|
"typescript-eslint": "^8.56.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12892
pnpm-lock.yaml
generated
Normal file
12892
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- swup
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
import { Icon } from 'astro-icon/components';
|
|
||||||
---
|
|
||||||
|
|
||||||
<div class="button-base button-bg-teal inline-flex shrink-0 rounded-lg gap-x-2">
|
|
||||||
<div class="button-text-title flex relative items-center text-center">
|
|
||||||
<span class="mr-2">
|
|
||||||
Read More
|
|
||||||
</span>
|
|
||||||
<Icon
|
|
||||||
name="mdi:keyboard-arrow-right"
|
|
||||||
class="button-hover-arrow"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -30,17 +31,25 @@ const { post } = Astro.props;
|
|||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col flex-1 rounded-xl p-4 md:p-5 mx-1 mb-2">
|
<div class="rounded-xl p-4 md:p-5 flex flex-col flex-1">
|
||||||
<div class="flex flex-row items-center mb-8">
|
<h3 class="card-text-title text-xl">
|
||||||
<h3 class="card-text-title card-hover-text-title text-2xl">
|
{post.title}
|
||||||
{post.title}
|
</h3>
|
||||||
</h3>
|
<div class="ml-6 flex mt-auto">
|
||||||
</div>
|
<div class="relative inline-block w-full">
|
||||||
<div class="mt-auto">
|
<div class="card-text-title card-hover-text-title flex relative items-center mx-auto min-h-11 sm:mx-0 sm:mt-4">
|
||||||
<PostMetadataSnippet
|
<span class="relative inline-block overflow-hidden ml-2">
|
||||||
enableCategoryLink={false}
|
Read more
|
||||||
post={post}
|
</span>
|
||||||
/>
|
<Icon
|
||||||
|
name="mdi:keyboard-arrow-right"
|
||||||
|
class="translate-y-0.5 transition duration-300 group-hover:translate-x-1"
|
||||||
|
/>
|
||||||
|
<p class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(post.published_date)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,53 +1,62 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import { formatDate } from '@support/time';
|
||||||
|
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: Post;
|
title: string;
|
||||||
|
subTitle: string;
|
||||||
|
url: string;
|
||||||
|
pubDate: Date,
|
||||||
|
img: string;
|
||||||
|
imgAlt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { title, subTitle, url, pubDate, img, imgAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
||||||
<a
|
<a
|
||||||
class="md:card-base-hidden group md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
class="md:card-base-hidden group items-center md:grid md:grid-cols-2 lg:grid lg:grid-cols-2 gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
||||||
href={`/blog/${post.slug}`}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="h-full">
|
<div>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full object-cover"
|
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(img)}
|
||||||
alt={post.image_alt}
|
alt={imgAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col justify-center bg-background-card md:bg-transparent group-hover:bg-neutral-100 md:group-hover:bg-transparent dark:group-hover:bg-neutral-800/90 md:dark:group-hover:bg-transparent rounded-b-2xl transition-all duration-300 p-6 gap-4">
|
<div class="bg-background-card md:bg-transparent group-hover:bg-neutral-100 md:group-hover:bg-transparent dark:group-hover:bg-neutral-800/90 md:dark:group-hover:bg-transparent rounded-b-2xl transition-all duration-300 p-6">
|
||||||
<h2 class="card-text-header">
|
<h2 class="card-text-header mb-2">
|
||||||
{post.title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{post.description}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex md:flex-col-reverse lg:flex-row items-center md:items-start lg:items-center justify-between w-full md:gap-4">
|
<div class="card-text-title flex items-center justify-between w-full">
|
||||||
<div class="hidden md:block shrink-0 mt-4">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<ReadMoreButton/>
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
</div>
|
<span class="mr-2">
|
||||||
<div class="mt-2 lg:mt-4">
|
Read More
|
||||||
<PostMetadataSnippet
|
</span>
|
||||||
post={post}
|
<Icon
|
||||||
enableCategoryLink={false}
|
name="mdi:keyboard-arrow-right"
|
||||||
/>
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(pubDate)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,86 +1,104 @@
|
|||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import { formatDate } from '@support/time';
|
||||||
|
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: Post;
|
title: string;
|
||||||
|
subTitle: string;
|
||||||
|
url: string;
|
||||||
|
pubDate: Date;
|
||||||
|
imgOne: string;
|
||||||
|
imgOneAlt: string;
|
||||||
|
imgTwo?: string;
|
||||||
|
imgTwoAlt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { title, subTitle, url, pubDate, imgOne, imgOneAlt, imgTwo, imgTwoAlt } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
<div class="smooth-reveal flex flex-col px-4 py-10 mx-auto w-full">
|
||||||
<a
|
<a
|
||||||
class="md:card-base-hidden group flex flex-col-reverse md:grid md:items-center md:grid-cols-2 lg:grid lg:grid-cols-2 md:gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
class="md:card-base-hidden group flex flex-col-reverse md:grid md:items-center md:grid-cols-2 lg:grid lg:grid-cols-2 md:gap-8 xl:gap-16 w-full md:px-8 md:py-8"
|
||||||
href={`/blog/${post.slug}`}
|
href={url}
|
||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="flex flex-col bg-background-card md:bg-transparent group-hover:bg-neutral-100 md:group-hover:bg-transparent dark:group-hover:bg-neutral-800/90 md:dark:group-hover:bg-transparent rounded-b-2xl transition-all duration-300 p-6 gap-4">
|
<div class="bg-background-card md:bg-transparent group-hover:bg-neutral-100 md:group-hover:bg-transparent dark:group-hover:bg-neutral-800/90 md:dark:group-hover:bg-transparent rounded-b-2xl transition-all duration-300 p-6">
|
||||||
<h2 class="card-text-header">
|
<h2 class="card-text-header mb-2">
|
||||||
{post.title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose">
|
<p class="card-text-title font-light text-pretty sm:text-lg max-w-prose mb-8">
|
||||||
{post.description}
|
{subTitle}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex md:flex-col-reverse lg:flex-row items-center md:items-start lg:items-center justify-between w-full md:gap-4">
|
<div class="card-text-title flex items-center justify-between w-full">
|
||||||
<div class="hidden md:block shrink-0 mt-4">
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
<ReadMoreButton/>
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
</div>
|
<span class="mr-2">
|
||||||
<div class="mt-2 lg:mt-4">
|
Read More
|
||||||
<PostMetadataSnippet
|
</span>
|
||||||
post={post}
|
<Icon
|
||||||
enableCategoryLink={false}
|
name="mdi:keyboard-arrow-right"
|
||||||
/>
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="card-text-description text-sm ml-auto">
|
||||||
|
{formatDate(pubDate)}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{!post.image_second ? (
|
{!imgTwo ? (
|
||||||
<div class="h-full">
|
<div>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
class="rounded-2xl rounded-b-none md:rounded-2xl md:shadow-2xl w-full h-full sm:max-h-80 md:max-h-90 object-cover"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(imgOne)}
|
||||||
alt={post.image_alt}
|
alt={imgOneAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="h-full">
|
<>
|
||||||
<div class="md:hidden">
|
<div class="md:hidden">
|
||||||
<Image
|
<Image
|
||||||
class="rounded-2xl rounded-b-none shadow-2xl w-full h-full sm:max-h-80 object-cover"
|
class="rounded-2xl rounded-b-none shadow-2xl w-full h-full sm:max-h-80 object-cover"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(imgOne)}
|
||||||
alt={post.image_alt}
|
alt={imgOneAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="850"
|
||||||
|
height="420"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:flex md:items-start">
|
<div class="hidden md:flex md:items-start">
|
||||||
<Image
|
<Image
|
||||||
class="rounded-xl z-10 shadow-2xl w-3/5 h-full object-cover"
|
class="rounded-xl z-10 shadow-2xl w-3/5 h-full object-cover"
|
||||||
src={getDirectusImageURL(post.image)}
|
src={getDirectusImageURL(imgOne)}
|
||||||
alt={post.image_alt}
|
alt={imgOneAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="600"
|
||||||
|
height="310"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
<Image
|
<Image
|
||||||
class="rounded-xl shadow-2xl w-3/5 h-full -ml-16 mt-12 object-cover"
|
class="rounded-xl shadow-2xl w-3/5 h-full -ml-16 mt-12 object-cover"
|
||||||
src={getDirectusImageURL(post.image_second)}
|
src={getDirectusImageURL(imgTwo)}
|
||||||
alt={post.image_second_alt}
|
alt={imgTwoAlt}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
width="600"
|
||||||
|
height="310"
|
||||||
inferSize={true}
|
inferSize={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
import ReadMoreButton from '@components/buttons/ReadMoreButton.astro';
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
import Logo from '@components/images/Logo.astro';
|
import Logo from '@components/images/Logo.astro';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
@@ -38,7 +39,17 @@ const { title, subTitle, url, logoLight, logoDark} = Astro.props;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block shrink-0 mr-4">
|
<div class="hidden md:block shrink-0 mr-4">
|
||||||
<ReadMoreButton/>
|
<div class="button-base button-bg-teal inline-flex rounded-lg gap-x-2">
|
||||||
|
<div class="button-text-title flex relative items-center text-center">
|
||||||
|
<span class="mr-2">
|
||||||
|
Read More
|
||||||
|
</span>
|
||||||
|
<Icon
|
||||||
|
name="mdi:keyboard-arrow-right"
|
||||||
|
class="button-hover-arrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const { dayName, label, icon, temp } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal-2 group flex flex-col">
|
<div class="smooth-reveal-2 group flex flex-col">
|
||||||
<div class="card-base w-40">
|
<div class="card-base w-32 md:w-40">
|
||||||
<div class="p-5 text-center">
|
<div class="p-5 text-center">
|
||||||
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
||||||
{dayName}
|
{dayName}
|
||||||
|
|||||||
31
src/components/sections/AllCategoriesSection.astro
Normal file
31
src/components/sections/AllCategoriesSection.astro
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
||||||
|
import directus from '@lib/directus';
|
||||||
|
import { timeago } from '@support/time';
|
||||||
|
|
||||||
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
|
||||||
|
const posts = await directus.request(
|
||||||
|
readItems('posts', {
|
||||||
|
filter: { published: { _eq: true } },
|
||||||
|
fields: ['*'],
|
||||||
|
sort: ['-published_date'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class:list={['mx-auto px-4 py-10 sm:px-6 lg:px-8 lg:py-14 lg:pt-10 2xl:max-w-full', Astro.props.className]}>
|
||||||
|
<div class="grid grid-cols-1">
|
||||||
|
<LargeCategoryCard
|
||||||
|
title="All Posts"
|
||||||
|
description="Here you can forgoe the organization and browse everything I've posted"
|
||||||
|
url="/all"
|
||||||
|
logoLight={global.all_logoLight}
|
||||||
|
logoDark={global.all_logoDark}
|
||||||
|
count={posts.length}
|
||||||
|
publishDate={timeago(posts[0]?.published_date)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
20
src/components/sections/AllPostsSection.astro
Normal file
20
src/components/sections/AllPostsSection.astro
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
|
import LargeLinkCard from '@components/cards/LargeLinkCard.astro';
|
||||||
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class:list={['mx-auto px-4 pb-10 sm:px-6 lg:px-8 lg:pb-14 2xl:max-w-full', Astro.props.className]}>
|
||||||
|
<div class="grid grid-cols-1">
|
||||||
|
<LargeLinkCard
|
||||||
|
title="All Posts"
|
||||||
|
subTitle="Catch up on everything I've written so far here"
|
||||||
|
url="/all"
|
||||||
|
logoLight={global.all_logoLight}
|
||||||
|
logoDark={global.all_logoDark}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
---
|
---
|
||||||
import { readItems, readSingleton } from '@directus/sdk';
|
import { readItems } from '@directus/sdk';
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import CategoryCard from '@components/cards/CategoryCard.astro';
|
import CategoryCard from '@components/cards/CategoryCard.astro';
|
||||||
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
import { timeago } from '@support/time';
|
import { timeago } from '@support/time';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
|
||||||
|
|
||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*', 'category.slug'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -98,16 +95,5 @@ const categories = (await directus.request(readItems('categories')))
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<div class="col-span-full mt-8">
|
|
||||||
<LargeCategoryCard
|
|
||||||
title="All Posts"
|
|
||||||
description="Here you can forgoe the organization and browse everything I've posted"
|
|
||||||
url="/all"
|
|
||||||
logoLight={global.all_logoLight}
|
|
||||||
logoDark={global.all_logoDark}
|
|
||||||
count={posts.length}
|
|
||||||
publishDate={timeago(posts[0]?.published_date)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import directus from '@lib/directus';
|
|||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="max-w-340 2xl:max-w-full px-4 py-10 mx-auto mb-2 md:mb-8">
|
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-8">
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex flex-col sm:flex-row items-center justify-center gap-y-2 sm:gap-x-12 sm:gap-y-0 lg:gap-x-24">
|
||||||
<div class="max-w-5xl">
|
<div class="max-w-5xl sm:px-6 lg:px-8">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6">
|
<div class="flex flex-wrap gap-6 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3 justify-center">
|
||||||
<FeaturesCard
|
<FeaturesCard
|
||||||
title="Cloud Engineer"
|
title="Cloud Engineer"
|
||||||
description="Full stack and cloud engineer."
|
description="Full stack and cloud engineer."
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { readSingleton } from '@directus/sdk';
|
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import BlogCard from '@components/cards/BlogCard.astro';
|
import BlogCard from '@components/cards/BlogCard.astro';
|
||||||
import LargeLinkCard from '@components/cards/LargeLinkCard.astro';
|
|
||||||
import directus from '@lib/directus';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
@@ -13,8 +9,6 @@ interface Props {
|
|||||||
subTitle?: string;
|
subTitle?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
|
||||||
|
|
||||||
const { posts, title, subTitle } = Astro.props;
|
const { posts, title, subTitle } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -33,14 +27,5 @@ const { posts, title, subTitle } = Astro.props;
|
|||||||
{posts.map((b) =>
|
{posts.map((b) =>
|
||||||
<BlogCard post={b} />
|
<BlogCard post={b} />
|
||||||
)}
|
)}
|
||||||
<div class="col-span-full">
|
|
||||||
<LargeLinkCard
|
|
||||||
title="All Posts"
|
|
||||||
subTitle="Catch up on everything I've written"
|
|
||||||
url="/all"
|
|
||||||
logoLight={global.all_logoLight}
|
|
||||||
logoDark={global.all_logoDark}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -13,8 +13,24 @@ const { posts } = Astro.props;
|
|||||||
|
|
||||||
<section class="smooth-reveal flex flex-col gap-4 md:mb-20">
|
<section class="smooth-reveal flex flex-col gap-4 md:mb-20">
|
||||||
{posts.map((post, index) => index % 2 === 0 ? (
|
{posts.map((post, index) => index % 2 === 0 ? (
|
||||||
<LargeBlogLeftCard post={post}/>
|
<LargeBlogLeftCard
|
||||||
|
title={post.title}
|
||||||
|
subTitle={post.description}
|
||||||
|
url={`/blog/${post.slug}`}
|
||||||
|
pubDate={post.published_date}
|
||||||
|
img={post.image}
|
||||||
|
imgAlt={post.image_alt}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<LargeBlogRightCard post={post}/>
|
<LargeBlogRightCard
|
||||||
|
title={post.title}
|
||||||
|
subTitle={post.description}
|
||||||
|
url={`/blog/${post.slug}`}
|
||||||
|
pubDate={post.published_date}
|
||||||
|
imgOne={post.image}
|
||||||
|
imgOneAlt={post.image_alt}
|
||||||
|
imgTwo={post?.image_second}
|
||||||
|
imgTwoAlt={post?.image_second_alt}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -24,15 +24,13 @@ const { forecastDays, error } = await getFiveDayForecast(latitude, longitude, ti
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
||||||
{forecastDays.map((forecastDay, index) => (
|
{forecastDays.map((forecastDay) => (
|
||||||
<div class={index === 3 ? "hidden min-[800px]:block" : index >= 4 ? "hidden min-[1100px]:block" : ""}>
|
<WeatherCard
|
||||||
<WeatherCard
|
dayName={forecastDay.dayName}
|
||||||
dayName={forecastDay.dayName}
|
label={forecastDay.label}
|
||||||
label={forecastDay.label}
|
icon={forecastDay.icon}
|
||||||
icon={forecastDay.icon}
|
temp={forecastDay.temp}
|
||||||
temp={forecastDay.temp}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
---
|
|
||||||
import getReadingTime from 'reading-time';
|
|
||||||
|
|
||||||
import type { Post } from '@lib/directusTypes';
|
|
||||||
|
|
||||||
import Logo from '@components/images/Logo.astro';
|
|
||||||
import { formatShortDate, formatDate } from '@support/time';
|
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
post: Post;
|
|
||||||
enableCategoryLink?: boolean;
|
|
||||||
dateFormat?: 'short' | 'long';
|
|
||||||
}
|
|
||||||
|
|
||||||
const { post, enableCategoryLink = true, dateFormat = 'short' } = Astro.props;
|
|
||||||
|
|
||||||
const readingTime = getReadingTime(post.content || '');
|
|
||||||
---
|
|
||||||
|
|
||||||
<ol class="flex items-center justify-start card-text-description text-sm whitespace-nowrap gap-2 sm:gap-0 overflow-hidden">
|
|
||||||
{post.category && (
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
{enableCategoryLink ? (
|
|
||||||
<a
|
|
||||||
class="inline-flex items-center hover:card-hover-text-description overflow-hidden"
|
|
||||||
href={`/categories/${post.category.slug}`}
|
|
||||||
data-astro-prefetch
|
|
||||||
>
|
|
||||||
<div class="flex flex-row items-center shrink-0">
|
|
||||||
<div class="mr-2">
|
|
||||||
<Logo
|
|
||||||
srcLight={getDirectusImageURL(post.category.logoLight)}
|
|
||||||
srcDark={getDirectusImageURL(post.category.logoDark)}
|
|
||||||
alt={`Logo of ${post.category.title}`}
|
|
||||||
width={18}
|
|
||||||
height={18}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{post.category.title}
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
<div class="inline-flex items-center overflow-hidden">
|
|
||||||
<div class="flex flex-row items-center shrink-0">
|
|
||||||
<div class="mr-2">
|
|
||||||
<Logo
|
|
||||||
srcLight={getDirectusImageURL(post.category.logoLight)}
|
|
||||||
srcDark={getDirectusImageURL(post.category.logoDark)}
|
|
||||||
alt={`Logo of ${post.category.title}`}
|
|
||||||
width={18}
|
|
||||||
height={18}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{post.category.title}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 mx-2">
|
|
||||||
/
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 overflow-hidden">
|
|
||||||
{dateFormat === 'short' ? formatShortDate(post.published_date) : formatDate(post.published_date)}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 mx-2">
|
|
||||||
/
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<li class="inline-flex items-center">
|
|
||||||
<span class="shrink-0 overflow-hidden">
|
|
||||||
{readingTime.minutes.toPrecision(1)} minutes
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
@@ -10,7 +10,7 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
import { Image } from 'astro:assets';
|
import { Image } from 'astro:assets';
|
||||||
|
import getReadingTime from 'reading-time';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import markedShiki from 'marked-shiki';
|
import markedShiki from 'marked-shiki';
|
||||||
import { createHighlighter } from 'shiki';
|
import { createHighlighter } from 'shiki';
|
||||||
@@ -8,16 +9,17 @@ import { readItems, readSingleton } from '@directus/sdk';
|
|||||||
import 'photoswipe/style.css';
|
import 'photoswipe/style.css';
|
||||||
|
|
||||||
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
||||||
import PostMetadataSnippet from '@/components/snippets/PostMetadataSnippet.astro';
|
import Logo from '@components/images/Logo.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
import { formatDate } from '@support/time';
|
||||||
import { getDirectusImageURL } from '@/support/url';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
const post = Astro.props;
|
const post = Astro.props;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await directus.request(readItems('posts', {
|
const posts = await directus.request(readItems('posts', {
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*', 'category.*'],
|
||||||
}));
|
}));
|
||||||
return posts.map((post) => ({
|
return posts.map((post) => ({
|
||||||
params: { slug: post.slug },
|
params: { slug: post.slug },
|
||||||
@@ -26,6 +28,9 @@ export async function getStaticPaths() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
const category = post.category;
|
||||||
|
|
||||||
|
const readingTime = getReadingTime(post.content || '');
|
||||||
|
|
||||||
const highlighter = await createHighlighter({
|
const highlighter = await createHighlighter({
|
||||||
themes: ['github-light', 'github-dark'],
|
themes: ['github-light', 'github-dark'],
|
||||||
@@ -96,12 +101,46 @@ const content = marked.parse(post.content || '');
|
|||||||
<h2 class="card-text-header block">
|
<h2 class="card-text-header block">
|
||||||
{post.title}
|
{post.title}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="mt-4 sm:mt-6">
|
<ol class="flex items-center justify-center sm:justify-start whitespace-nowrap gap-2 sm:gap-0 mt-6 sm:mt-4">
|
||||||
<PostMetadataSnippet
|
{category && (
|
||||||
post={post}
|
<li class="inline-flex items-center">
|
||||||
dateFormat='long'
|
<a
|
||||||
/>
|
class="inline-flex items-center text-secondary hover:text-secondary-hover text-sm transition-all duration-300"
|
||||||
</div>
|
href=`/categories/${category.slug}`
|
||||||
|
data-astro-prefetch
|
||||||
|
>
|
||||||
|
<div class="flex flex-row items-center shrink-0">
|
||||||
|
<div class="mr-2">
|
||||||
|
<Logo
|
||||||
|
srcLight={getDirectusImageURL(category.logoLight)}
|
||||||
|
srcDark={getDirectusImageURL(category.logoDark)}
|
||||||
|
alt={`Logo of ${category.title}`}
|
||||||
|
width = 18,
|
||||||
|
height = 18,
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{category.title}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<span class="shrink-0 text-secondary text-sm mx-2 sm:mx-4">
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
<li class="inline-flex items-center">
|
||||||
|
<span class="shrink-0 text-secondary text-sm">
|
||||||
|
{formatDate(post.published_date)}
|
||||||
|
</span>
|
||||||
|
<span class="shrink-0 text-secondary text-sm mx-2 sm:mx-4">
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="inline-flex items-center">
|
||||||
|
<span class="shrink-0 text-secondary text-sm">
|
||||||
|
{readingTime.minutes.toPrecision(1)} minutes to read
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-divider mt-10 mb-10"/>
|
<div class="border-t border-divider mt-10 mb-10"/>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { Post } from '@lib/directusTypes';
|
|||||||
import HeroSection from '@components/sections/HeroSection.astro';
|
import HeroSection from '@components/sections/HeroSection.astro';
|
||||||
import SelectedPostsSection from '@components/sections/SelectedPostsSection.astro';
|
import SelectedPostsSection from '@components/sections/SelectedPostsSection.astro';
|
||||||
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
||||||
|
import AllPostsSection from '@components/sections/AllPostsSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -56,6 +57,8 @@ const recentPosts: Post[] = posts.filter(
|
|||||||
title="Recent Posts"
|
title="Recent Posts"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AllPostsSection />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*', 'category.slug'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { readSingleton } from '@directus/sdk';
|
|||||||
|
|
||||||
import HeroSection from '@components/sections/HeroSection.astro';
|
import HeroSection from '@components/sections/HeroSection.astro';
|
||||||
import CategorySection from '@components/sections/CategorySection.astro';
|
import CategorySection from '@components/sections/CategorySection.astro';
|
||||||
|
import AllCategoriesSection from '@components/sections/AllCategoriesSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
|
|
||||||
@@ -36,6 +37,8 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
|
|
||||||
<CategorySection />
|
<CategorySection />
|
||||||
|
|
||||||
|
<AllCategoriesSection />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import HeroSection from '@components/sections/HeroSection.astro';
|
|||||||
import FeatureSection from '@components/sections/FeatureSection.astro';
|
import FeatureSection from '@components/sections/FeatureSection.astro';
|
||||||
import WeatherSection from '@components/sections/WeatherSection.astro';
|
import WeatherSection from '@components/sections/WeatherSection.astro';
|
||||||
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
import RecentPostsSection from '@components/sections/RecentPostsSection.astro';
|
||||||
|
import AllPostsSection from '@components/sections/AllPostsSection.astro';
|
||||||
import GiteaSection from '@components/sections/GiteaSection.astro';
|
import GiteaSection from '@components/sections/GiteaSection.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
@@ -16,7 +17,7 @@ const weather = await directus.request(readSingleton('site_weather'));
|
|||||||
const posts = await directus.request(
|
const posts = await directus.request(
|
||||||
readItems('posts', {
|
readItems('posts', {
|
||||||
filter: { published: { _eq: true } },
|
filter: { published: { _eq: true } },
|
||||||
fields: ['*', { category: ['*'] }],
|
fields: ['*'],
|
||||||
sort: ['-published_date'],
|
sort: ['-published_date'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -69,6 +70,8 @@ const recentPosts = posts
|
|||||||
subTitle="Checkout my most recent thoughts here"
|
subTitle="Checkout my most recent thoughts here"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AllPostsSection />
|
||||||
|
|
||||||
<GiteaSection
|
<GiteaSection
|
||||||
title="Follow me on Gitea"
|
title="Follow me on Gitea"
|
||||||
subTitle="I love open source and have my code availabile on my Gitea server."
|
subTitle="I love open source and have my code availabile on my Gitea server."
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import rss, { type RSSFeedItem } from '@astrojs/rss';
|
|||||||
import type { APIContext } from 'astro';
|
import type { APIContext } from 'astro';
|
||||||
import { transform, walk } from 'ultrahtml';
|
import { transform, walk } from 'ultrahtml';
|
||||||
import sanitize from 'ultrahtml/transformers/sanitize';
|
import sanitize from 'ultrahtml/transformers/sanitize';
|
||||||
import MarkdownIt from 'markdown-it';
|
|
||||||
|
|
||||||
import { readItems, readSingleton } from '@directus/sdk';
|
import { readItems, readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
@@ -14,8 +12,6 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
let baseUrl = context.site?.href || global.site_url;
|
let baseUrl = context.site?.href || global.site_url;
|
||||||
const parser = new MarkdownIt();
|
|
||||||
|
|
||||||
if (baseUrl.at(-1) === '/') {
|
if (baseUrl.at(-1) === '/') {
|
||||||
baseUrl = baseUrl.slice(0, -1);
|
baseUrl = baseUrl.slice(0, -1);
|
||||||
}
|
}
|
||||||
@@ -30,7 +26,7 @@ export async function GET(context: APIContext) {
|
|||||||
|
|
||||||
const feedItems: RSSFeedItem[] = [];
|
const feedItems: RSSFeedItem[] = [];
|
||||||
for (const post of posts) {
|
for (const post of posts) {
|
||||||
const content = await transform(parser.render(post.content), [
|
const content = await transform(post.content.replace(/^<!DOCTYPE html>/, ''), [
|
||||||
async (node) => {
|
async (node) => {
|
||||||
await walk(node, (node) => {
|
await walk(node, (node) => {
|
||||||
if (node.name === 'a' && node.attributes.href?.startsWith('/')) {
|
if (node.name === 'a' && node.attributes.href?.startsWith('/')) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
@utility card-hover-icon-scale {
|
@utility card-hover-icon-scale {
|
||||||
@apply transition-transform duration-300 will-change-transform
|
@apply transition-transform duration-300 will-change-transform
|
||||||
drop-shadow-md dark:drop-shadow-xl dark:drop-shadow-neutral-500/60
|
drop-shadow-md dark:drop-shadow-xl dark:drop-shadow-neutral-500/60
|
||||||
group-hover:scale-3d group-hover:scale-105
|
group-hover:scale-3d group-hover:scale-110
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility card-text-header {
|
@utility card-text-header {
|
||||||
@@ -127,11 +127,6 @@
|
|||||||
@apply text-secondary
|
@apply text-secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility card-hover-text-description {
|
|
||||||
@apply transition-all duration-300
|
|
||||||
text-secondary-hover
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
@utility nav-base {
|
@utility nav-base {
|
||||||
@apply border border-neutral-100 dark:border-stone-500/20
|
@apply border border-neutral-100 dark:border-stone-500/20
|
||||||
|
|||||||
@@ -39,11 +39,4 @@ function formatDate(date: Date): string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatShortDate(date: Date): string {
|
export { formatDate, timeago };
|
||||||
return new Date(date).toLocaleDateString('en-US', {
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export { formatDate, formatShortDate, timeago };
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const getSiteURL = () => {
|
|||||||
return 'https://www.alexlebens.dev';
|
return 'https://www.alexlebens.dev';
|
||||||
};
|
};
|
||||||
|
|
||||||
function getDirectusImageURL(image: string) {
|
async function getDirectusImageURL(image: string) {
|
||||||
return `${getDirectusURL()}/assets/${image}`;
|
return `${getDirectusURL()}/assets/${image}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user