Your first website
Create, edit and preview a page on a Minecraft computer. No modem is needed for the local preview.
On this page
1. Install Lantern
Run this in the CraftOS shell. HTTP must be enabled and lantern.thultz.dev allowed by your Minecraft server. Choose Browser + hosting or Hosting tools. Both include the renderer needed for local previews.
wget run https://lantern.thultz.dev/downloads/lantern.lua2. Create a local site
The site lives at /lantern-data/sites/my-first-site. You can also start with lantern edit. Site names on your computer do not automatically reserve the same address on the Hub.
- Choose Create a site from a template.
- Enter my-first-site (2–40 lowercase letters, digits or hyphens; start with a letter or digit).
- Choose personal. You will arrive at the site management menu.
lantern host3. Edit the page
Choose Edit page JSON. Accept /index.json. Replace the file with this page, then save and exit the CraftOS editor. Ctrl opens its menu; choose Save, then Exit.
{
"version": 1,
"title": "My first site",
"children": [
{
"type": "heading",
"text": "Hello, other worlds!"
},
{
"type": "paragraph",
"text": "I made this page with Lantern."
}
]
}4. Validate and preview
- Choose Validate site. It checks JSON pages, loads app.lua if present, and tries the home-page GET.
- Choose Preview locally. You should see your heading and paragraph.
- Use the browser menu to Quit and return to the editor.
5. Try your first Lua page
Choose Edit server Lua. For a static template, Lantern creates a working starter app.lua. Replace its content with the code below. Save, validate, then preview. You should see “testing”.
When app.lua returns a page, that response takes precedence over index.json. To return to a static-only site, remove app.lua after saving a backup, or make the handler return nil for GET paths.
return function(ctx)
local P = ctx.page
return {kind="page", page=P.document("My first site", {
P.heading{text="Hello, other worlds!"},
P.paragraph{text="testing"},
P.link{text="Explore the Hub", href="hub://directory/"}
})}
endFound a mismatch? Include the exact error, runtime version and a small example with secrets removed.