Skip to content

Commit

Permalink
add ChatGPT SEO function
Browse files Browse the repository at this point in the history
  • Loading branch information
btholt committed Jul 28, 2023
1 parent 1a0bc89 commit 95d1baf
Show file tree
Hide file tree
Showing 9 changed files with 1,349 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ yarn-error.log*
.env.production.local

*.csv

.env
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ Each of these lessons can have a [frontmatter](https://github.com/jonschlinkert/

- _title_ – If you want the title to be different from the file name, you can specify here what that title should be. Frequently this useful for things where the capitalization would be off e.g. TailwindCSS instead of Tailwindcss. Optional.
- _description_ – If you want to give individual lessons descriptions for SEO and for Frontend Masters, you can write a brief description here.
- _keywords_ - If you want to give individual lessons keywords for SEO purposes, write a comma separated list

🤖: now the course starter can auto-generate the description and keywords for you using ChatGPT. See below how to.

Be aware because of how the numbers and letters are stripped out, it is possible to have ambigious paths. `01-welcome/A-intro.md` and `03-welcome/D-intro.md` would resolve to the same thing and only the first one would be visitable.

Expand Down Expand Up @@ -113,6 +116,7 @@ If you want a custom domain, make sure you uncomment the `fqdn` field in [.githu
- `npm run export` - Builds your site statically, use this if you're going to deploy to GitHub Pages, S3, or somewhere else with no server. This will run next build and then next export (no need to run build yourself first.)
- `npm run start` - Start an already-built server.
- `npm run csv` – Will generate the CSV of the metadata from your course. Note you may have to run build first, depending on your csvPath.
- `npm run seo` – Using ChatGPT, every file that does not have a description, ChatGPT will generate a description and keywords and write them to the file. Requires you to set a valid `OPENAI_API_KEY` (which means having a paid OpenAI account) using a [.env](https://github.com/motdotla/dotenv) or just by setting it in the environment. If a description already exists, this will skip it.

## Analytics

Expand Down
1 change: 1 addition & 0 deletions data/lesson.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export async function getLesson(targetDir, targetFile) {
return {
attributes: data,
html,
markdown: content,
slug: targetFile,
title,
section,
Expand Down
5 changes: 5 additions & 0 deletions lessons/01-the-first-section/A-intro.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
title: "Introduction"
description: "The introduction to this course."
keywords:
- A course starter
- Next.js
- React
- Brian Holt
---

Hello! And welcome to the Next.js course starter by [Brian Holt][twitter].
Expand Down
Loading

0 comments on commit 95d1baf

Please sign in to comment.