diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38e6992..45fef5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,12 @@ name: Node.js CI on: push: - branches: [ "main" ] + branches: ['main'] pull_request: - branches: [ "main" ] + branches: ['main'] jobs: build: - runs-on: ubuntu-latest strategy: @@ -20,14 +19,14 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run format - - run: npm run lint - - run: npm run build + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run format + - run: npm run lint + - run: npm run build # - run: npm run ci:test diff --git a/README.md b/README.md index 13df9b4..3a90b18 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ You can preview the production build with `npm run preview`. ## Future work(TODO) -- Preview for Nostr Events in article +- Preview for Nostr Events in article - Config - Black list - Thumbnail image diff --git a/src/lib/server/blog-store.service.ts b/src/lib/server/blog-store.service.ts index 722f975..524543c 100644 --- a/src/lib/server/blog-store.service.ts +++ b/src/lib/server/blog-store.service.ts @@ -12,14 +12,16 @@ export class BlogStoreService { const blogs: Blog[] = events .map((e) => { const identifierTag = e.tags.find((t) => t[0] === 'd') ?? []; - const title = e.tags.find((t) => t[0] === 'title') ?? []; - const summary = e.tags.find((t) => t[0] === 'summary') ?? []; + const titleTag = e.tags.find((t) => t[0] === 'title') ?? []; + const summaryTag = e.tags.find((t) => t[0] === 'summary') ?? []; + const imageTag = e.tags.find((t) => t[0] === 'image') ?? []; const hashTags = e.tags.filter((t) => t[0] === 't').map((t) => t[1]); return { ...e, identifier: identifierTag[1], - title: title[1], - summary: summary[1], + title: titleTag[1], + summary: summaryTag[1], + image: imageTag[1], hashTags }; }) diff --git a/src/lib/types.ts b/src/lib/types.ts index da14a68..030d41a 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -3,6 +3,7 @@ import type { NostrEventExt } from 'nostr-fetch'; export interface Blog extends NostrEventExt { title: string; summary: string; + image: string; hashTags: string[]; identifier: string; naddress: string; diff --git a/src/routes/blog/[slug]/+page.svelte b/src/routes/blog/[slug]/+page.svelte index 6af6fb0..aa2dd8e 100644 --- a/src/routes/blog/[slug]/+page.svelte +++ b/src/routes/blog/[slug]/+page.svelte @@ -5,6 +5,9 @@
+ {#if !!data.blog.image} + thumbnail + {/if}

{data.blog.title}

naddress: