Beautiful.
I see you: clean, excited, deadly with copy-paste, sitting inside a virtualenv (myenv
) in your project directory.
You have:
wikipedia/ # <-- This is where you want to build your private Wikipedia
I will lead you step-by-step, assuming you donβt want to reread anything β you just want action.
wikipedia
foldercd wikipedia
Weβll do it by hand for total awareness (donβt worry, itβs fast).
Create the folders:
mkdir style js images
Now your structure is:
wikipedia/
βββ images/
βββ js/
βββ style/
Touch them into existence:
touch index.html first-article.html
touch style/main.css style/darkmode.css
touch js/toggle-darkmode.js
touch images/placeholder.png
touch favicon.ico
touch README.md
Now your structure looks like:
wikipedia/
βββ index.html
βββ first-article.html
βββ style/
β βββ main.css
β βββ darkmode.css
βββ js/
β βββ toggle-darkmode.js
βββ images/
β βββ placeholder.png
βββ favicon.ico
βββ README.md
β Files ready to be populated.
wikipedia/
folder in VS Codecode .
(Make sure youβre still inside the wikipedia/
directory when you do this.)
Now paste the content I gave you before into each corresponding file:
File | What to Paste |
---|---|
index.html |
Landing page template |
first-article.html |
First article template |
style/main.css |
Main CSS (Wikipedia minimal style) |
style/darkmode.css |
Dark mode overrides |
js/toggle-darkmode.js |
JavaScript for dark mode toggling |
README.md |
Basic description (you can improvise) |
favicon.ico |
Itβs empty for now β replace later if you want |
images/placeholder.png |
Empty for now β replace with real images later |
Paste carefully into the right files.
You can even paste nonsense for now if youβre too hyped β youβll clean it later.
You want to see it running locally without deploying?
If you have Python installed (you do, youβre inside myenv
), run a local HTTP server:
python -m http.server
It will serve the current folder at:
http://localhost:8000
π Open that URL in your browser.
π Click around: index page, first article, toggle dark mode β all live.
Later when youβre ready:
git init
git add .
git commit -m "First commit - Private Wiki Launch"
gh repo create wikipedia --public --source=. --remote=origin
git push -u origin main
And enable GitHub Pages to serve from / (root)
.
Now back in wikipedia/
, you want the Python script too.
Create the CLI tool:
touch wiki.py
Paste the wiki.py
content I gave you into it.
β Done.
Now whenever you want to create a new page:
python wiki.py create "Greatness of Apollo"
Boom β new HTML page generated inside wikipedia/
, ready to link.
| Step | Command |
|:ββ|:βββ|
| Go into wikipedia | cd wikipedia
|
| Make folders | mkdir style js images
|
| Make files | touch index.html first-article.html ...
|
| Open VS Code | code .
|
| Paste all code | (copy-paste beast mode) |
| Preview locally | python -m http.server
|
| Create pages | python wiki.py create "Article Title"
|
You can now:
wiki.py toc
(auto-update Table of Contents with links)wiki.py search
(search inside your HTML)wiki.py list
(list all articles nicely)READY TO BUILD NEXT?
Want me to code βauto-TOC generatorβ next so you donβt even have to manually edit index.html
anymore?
π Just say TOC time! π