English
Starting a site
This page starts a site of your own for your data models, a node, and publishes it: from the first command to your own domain. Not sure yet whether you need one? See Your own data models.
The result looks like models.gtt-project.org: catalog.json, the @context, JSON Schemas, a vocabulary, examples, and a page for every type and attribute.
What you need
- Node.js 24 or later. The commands run with
npx; there is nothing to install. - A GitHub account, for GitHub Pages.
- A domain or subdomain you control, such as
models.example.org(recommended, step 3).
1. Start the node
bash
npx @geolonia/datamodels@0.4.3 init my-models
cd my-modelsinit asks a few questions:
- Base URL: where the node will be, for example
https://models.example.org. It is part of every IRI the node publishes, so choose it once: you cannot change it after you publish. Ahttps://<account>.github.io/<repository>address works too, but then your IRIs depend on the name of your GitHub account. For IRIs that outlive the domain, use a w3id.org address. - IRI form:
hash(the default) makes IRIs such as/ns/road#RoadPatrol, which work on any static host, GitHub Pages included.slashmakes/ns/road/RoadPatrol, which needs w3id.org or a server that redirects. - Languages: for example
ja,en. One is enough. - Publisher: your organisation's name and website.
- Licence:
CC0-1.0lets anyone use the models without conditions, like this catalog. - The first subject: a group of models that share one
@context, for exampleroad. Its name is part of the IRIs too.
It writes node.yaml (the settings), models/road/ (the subject), a README, .gitignore, LICENSE (the licence text for CC0-1.0 and CC-BY-4.0; for another licence, add the text yourself), the workflow that publishes the node, and a Dependabot configuration that proposes new toolkit releases. A licence file under another name (LICENSE.md, LICENSE.txt, COPYING) counts as LICENSE.
init writes title and description in node.yaml as comments, with empty texts. Fill in each language, then remove the # (node.yaml).
It also works in an existing repository, for example one made by a scaffolder: it adds only the files that are missing, never overwrites one, and adds its lines to an existing .gitignore. It lists what it added and what it kept.
The options give the answers, so init can run in a script or in CI. There it never asks: a missing answer is a usage error. Without an answer, the defaults are hash IRIs, English and CC0-1.0.
bash
npx @geolonia/datamodels@0.4.3 init my-models \
--base-url https://models.example.org --iris hash --languages ja,en \
--publisher "Example Inc." --publisher-url https://example.org/ \
--license CC0-1.0 --subject road --yesWith the GitHub CLI (gh), add --github my-org/my-models: init then also creates that public repository, pushes the files and turns on GitHub Pages (step 2). In a folder whose remote is already that repository, it keeps the remote and only sets Pages to deploy from GitHub Actions. A remote to another repository is refused. Without a remote, it commits only the files init wrote, and pushes them. In a folder that is not a git repository yet, it stops when the folder has other files. In a git repository without a remote, it stops on uncommitted changes or a branch other than main; files you already committed are pushed with their history.
2. Publish on GitHub Pages
If you started with --github, the repository exists: commit your models and other changes, and push them.
Otherwise, create an empty repository on GitHub (without a README or any other file) and push the folder to its main branch, with your repository's name instead of my-org/my-models:
bash
git init -b main
git add .
git commit -m "Start the data model site"
git remote add origin https://github.com/my-org/my-models.git
git push -u origin mainThen, in the repository's Settings → Pages, set Source to GitHub Actions.
From then on, every push to main builds the node and publishes it. Until you set up your domain, the site is at https://<account>.github.io/<repository>/.
3. Your domain
- At your DNS provider, add a CNAME record from your subdomain to
<account>.github.io, for examplemodels→my-org.github.io. - In Settings → Pages, enter the domain under Custom domain. When GitHub has its certificate (minutes to an hour), turn on Enforce HTTPS.
It is worth verifying the domain for your account or organisation, so nobody else can publish a site on it.
4. A permanent address (optional)
Your IRIs contain your domain, so they last as long as you keep the domain. If the models may outlive it (a project that ends, a team that moves), take an address from w3id.org, a free redirect service run by the W3C Permanent Identifier Community Group. https://w3id.org/<name>/ forwards to wherever the node is; when the node moves, only the redirect changes.
Decide before you publish: the base URL is part of every IRI.
Choose a name: lower-case letters, digits and hyphens, not a generic word, for example
my-org-models. Check that it is free inids/, including other cases (ids/Foo/andids/foo/cannot both exist). A personal node goes under the shared/people/space (https://w3id.org/people/<name>/), not a name of its own.In step 1, give
https://w3id.org/my-org-modelsas the base URL, and publish the node at your domain (steps 2 and 3). The site itself stays there; every link and IRI the node publishes goes through w3id.org, so they work once the redirect is in place.Open a pull request to perma-id/w3id.org that adds
ids/my-org-models/.htaccesswith your contact and the redirect:apache# # /my-org-models/ # # https://w3id.org/my-org-models/ redirects to https://models.example.org/ # # ## Contact # This space is administered by: # # Your Name # you@example.org # GitHub username: your-account RewriteEngine on RewriteRule ^(.*)$ https://models.example.org/$1 [R=302,L]The rule keeps the path, so
https://w3id.org/my-org-models/ns/roadopenshttps://models.example.org/ns/road, and every IRI and file of the node works through it. Use 302, not 301: browsers keep a 301 forever, so you could not move the node later. The reviewers check that the target is online, which is why the node is published first. Read Creating an identifier before you open the pull request.
Hash IRIs work through the redirect: the part after # stays in the browser, so https://w3id.org/my-org-models/ns/road#RoadPatrol opens the right row of the page.
Other hosts
A node is plain files, so it can also go on a host other than GitHub Pages, such as Cloudflare Pages or Netlify: see Other hosts.
Once the site is there, go on with Your site's models.