Skip to content

Commit

Permalink
Blogpost and Discord Links
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Dec 25, 2024
1 parent 30aa820 commit 859a8cf
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"build": "npm run clean && run-p build:*",
"build:top-bun": "tb",
"watch": "npm run clean && run-p watch:*",
"watch:top-bun": "npm run build:top-bun -- --watch",
"clean": "rm -rf public && mkdir -p public"
"watch:top-bun": "npm run build:top-bun -- --watch --drafts",
"clean": "rm -rf public && mkdir -p public",
"new-blogpost": "node scripts/create-blogpost.js --title",
"publish-draft": "node scripts/publish-draft.js"
},
"dependencies": {
"classnames": "^2.3.2",
Expand Down
7 changes: 7 additions & 0 deletions scripts/BLOGPOST_DIR.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
export const __dirname = path.dirname(__filename)

export const BLOGPOST_DIR = path.join(__dirname, '../src/blog')
47 changes: 47 additions & 0 deletions scripts/create-blogpost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { parseArgs } from 'node:util'
import { BLOGPOST_DIR } from './BLOGPOST_DIR.js'

const __filename = fileURLToPath(import.meta.url)
export const __dirname = path.dirname(__filename)

const args = parseArgs({
options: {
title: {
type: 'string',
short: 't'
}
}
})

const title = args.values.title
if (!title) {
console.error('Please provide a title for the blog post.')
process.exit(1)
}

const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)+/g, '')
const currentYear = new Date().getFullYear()
const blogPostDir = path.join(BLOGPOST_DIR, `${currentYear.toString()}/${slug}`)
const readmePath = path.join(blogPostDir, 'README.draft.md')
const imgDir = path.join(blogPostDir, 'img')

await fs.mkdir(blogPostDir, { recursive: true })
await fs.mkdir(imgDir, { recursive: true })

const frontmatter = `---
layout: article
title: "${title}"
serif: false
publishDate: "${new Date().toISOString()}"
handlebars: false
---
Content goes here.
`

await fs.writeFile(readmePath, frontmatter, 'utf8')

console.log(`Blog post created at ${readmePath}`)
32 changes: 32 additions & 0 deletions scripts/publish-draft.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fs from 'node:fs/promises'
import path from 'node:path'
import { parseArgs } from 'node:util'
import { BLOGPOST_DIR } from './BLOGPOST_DIR.js'

const args = parseArgs({
allowPositionals: true
})

const slug = args.positionals[0]
if (!slug) {
console.error('Please provide the slug of the blog post.')
process.exit(1)
}

const currentYear = new Date().getFullYear()
const readmeDraftPath = path.join(BLOGPOST_DIR, `${currentYear.toString()}/${slug}/README.draft.md`)
const readmePath = path.join(BLOGPOST_DIR, `${currentYear.toString()}/${slug}/README.md`)

try {
let content = await fs.readFile(readmeDraftPath, 'utf8')
const newPublishDate = new Date().toISOString()
content = content.replace(/publishDate: ".*"/, `publishDate: "${newPublishDate}"`)

await fs.writeFile(readmeDraftPath, content, 'utf8')
await fs.rename(readmeDraftPath, readmePath)

console.log(`Draft published and renamed to ${readmePath}`)
} catch (error) {
console.error('Error processing the draft:', error)
process.exit(1)
}
33 changes: 33 additions & 0 deletions src/blog/2024/discord-and-2024/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: article
title: "Discord and 2024"
serif: false
publishDate: "2024-12-25T22:35:01.304Z"
handlebars: true
---

It looks like 2024 is about to end and I there haven't been any udpates to Gumcast! Lets remedey that.

## Join Our Discord

Gumcast now has a Discord:

- [#gumcast Discord Chat]({{ vars.discordUrl }})

Feel free to join up to ask any questions or report issues with Gumcast, and check out the family of other [HifiWifi](https://hifiwi.fi) products.

## An Uneventful Year

Basically nothing happened this year! Gumcast continues to operate as normally, and Gumroad hasn't added any podcasting or RSS features to the core service, so we'll keep the lights on for another year as operational costs remain low.

## Heard of 🥖 Breadcrum?

Check out [breadcrum.net](https://breadcrum.net), a bookmarking service that lets you send video and audio from around the web directly to your favorite podcast app.

![Breadcrum Screenshot](./img/breadcrum.png)

If you love Gumcast, you’ll enjoy Breadcrum—it makes consuming web content as seamless as enjoying your Gumroad content. Give it a try!

## Happy 2025

Wishing everyone a happy 2025! We hope Gumcast continues to bring you more value from your Gumroad content in the coming year.
Binary file added src/blog/2024/discord-and-2024/img/breadcrum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/blog/2024/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @template T
* @typedef {import('top-bun').PageFunction<T>} PageFunction
*/

export const vars = {
title: '2024 Blog Posts',
layout: 'blog-auto-index'
}

/**
* @type {PageFunction<{
* title: string
* publishDate: string
* }>}
*/
export default async function blogIndex2023 () {
return ''
}

0 comments on commit 859a8cf

Please sign in to comment.