Skip to content

Commit af99210

Browse files
authored
Merge pull request #1 from dtauer/main
Fixed Pages Config, Update README Instructions
2 parents a058f8f + 28af50f commit af99210

File tree

5 files changed

+42
-13
lines changed

5 files changed

+42
-13
lines changed

.github/workflows/next.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@master
13-
- name: npm install, export
13+
- name: npm install, build
1414
run: |
1515
npm install
16-
npm run export
16+
npm run build
1717
- name: Deploy site to gh-pages branch
1818
uses: crazy-max/ghaction-github-pages@v2
1919
with:

README.md

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
<h1 align="center">next-course-starter</h1> <br>
1+
<h1 align="center">Course Website Starter Template</h1> <br>
22

33
<p align="center">
4-
A NextJS starter to get you started creating educational materials using Markdown
4+
A starter template build in Next.js for creating educational materials using Markdown.
55
</p>
66

77
## Get Started
88

9-
1. Set up Node.js v14+
9+
1. Set up Node.js v20+
1010
1. Clone this repo
1111
1. Run `npm install`
1212
1. Run `npm run dev` to start the dev server
1313
1. Open http://localhost:3000 in a browser
1414

15+
_Instructions for deploying the course website to GitHub Pages are below_
16+
1517
## Configure Your Course
1618

1719
There are several things to configure before getting started.
@@ -94,14 +96,27 @@ The code blocks use [Highlight.js](https://highlightjs.org/static/demo/). By def
9496

9597
## GitHub Pages / GitHub Actions
9698

97-
By default this repo works with GitHub Pages. Just make sure you set the `productionBaseUrl` in the course.json to the name of the repo.
99+
By default this repo works with GitHub Pages (classic). Just make sure you set the `productionBaseUrl` in the course.json to the name of the repo.
98100

99-
It also includes a GitHub Action to automatically deploy to your gh-pages branch. Just make sure that your repo has GitHub Pages enabled and the branch is set to gh-pages. If you're not deploying to GitHub Pages go ahead and delete the `.github` directory.
101+
It also includes a GitHub Action to automatically deploy to your `gh-pages` branch. Just make sure that your repo has GitHub Pages (classic) enabled and the branch is set to `gh-pages`. If you're not deploying to GitHub Pages go ahead and delete the `.github` directory.
100102

101103
By default the GitHub Action looks for a `main` branch, so be sure you're using that instead of `master`.
102104

103105
If you want a custom domain, make sure you uncomment the `fqdn` field in [.github/workflows/next.yaml](https://github.com/btholt/next-course-starter/blob/main/.github/workflows/next.yaml) file and put your custom domain. If you don't do that and only set it up with the GitHub web GUI, every deploy will break the custom domain.
104106

107+
### GitHub Pages Instructions
108+
109+
These instructions assume you've followed the setup instructions above and have a cloned version of this repo locally.
110+
111+
1. Create a new (public) remote repository in your GitHub Account (e.g. fem-javascript-fundamentals).
112+
1. Grant `Read and write permissions` for Workflows under Actions > General > Workflow Permissions.
113+
1. Update the `productionBaseUrl` in the `course.json` file to match the name of the repository.
114+
1. Push to the new repository. You should see the `Deploy NextJS Course Site` workflow run under the Actions tab.
115+
1. Configure GitHub Pages: Settings > Pages > Deploy from a Branch. Select the `gh-pages` branch.
116+
1. Once the `pages-build-deployment` action completes, you should see your site at `https://USERNAME.github.io/REPO_NAME`.
117+
118+
_Future pushes to the main branch will automatically trigger a new deployment._
119+
105120
## Example Sites
106121

107122
- [This repo itself](https://btholt.github.io/next-course-starter/)
@@ -113,7 +128,6 @@ If you want a custom domain, make sure you uncomment the `fqdn` field in [.githu
113128

114129
- `npm run dev` - Next's dev command. Start a local dev server. Note if you have a productionBasePath set in your course.json, your dev server will respect that (so you don't mess up your paths in production.)
115130
- `npm run build` - Build your site for production. This will still include the Next.js server run time. Use this if you're using something like Vercel to host your site.
116-
- `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.)
117131
- `npm run start` - Start an already-built server.
118132
- `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.
119133
- `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.

next.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const course = JSON.parse(buffer);
66
const BASE_URL = course?.productionBaseUrl || "";
77

88
const config = {
9+
output: "export",
910
basePath: BASE_URL,
1011
env: {
1112
BASE_URL,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"scripts": {
77
"dev": "next dev",
88
"build": "next build && npm run csv",
9-
"export": "next build && next export && npm run csv",
109
"start": "next start",
1110
"csv": "node csv/index.js",
1211
"seo": "node summary/index.js"
@@ -16,6 +15,7 @@
1615
"gray-matter": "^4.0.3",
1716
"highlight.js": "^11.9.0",
1817
"marked": "^11.1.1",
18+
"marked-highlight": "^2.1.1",
1919
"next": "^14.0.4",
2020
"react": "^18.2.0",
2121
"react-dom": "^18.2.0",

styles/courses.css

+18-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ h2,
1111
h3,
1212
h4,
1313
h5,
14-
h6,
15-
p,
16-
ol,
17-
ul {
14+
h6 {
1815
margin: 0;
1916
padding: 0;
2017
font-weight: normal;
@@ -517,3 +514,20 @@ ol.sections-name .lesson-details {
517514
line-height: 24px;
518515
padding: 0px 5px;
519516
}
517+
518+
code,
519+
pre code {
520+
padding: .5rem;
521+
}
522+
523+
code,
524+
pre code,
525+
pre code.hljs {
526+
background-color: var(--emphasized-bg);
527+
color: #000;
528+
}
529+
530+
pre code,
531+
pre code.hljs {
532+
display: block;
533+
}

0 commit comments

Comments
 (0)