nginx / nginx.org

Sources for the NGINX website and documentation
https://nginx.org
Other
48 stars 18 forks source link

nginx.org website

This repository hosts the content and static site generator for nginx.org.

The website is primarily authored in XML and converted to static HTML content through Extensible Stylesheet Language Transformations (XSLT).

Static site generation

The .xslt files in this repo are automatically generated and should not be edited directly. XML transformation is defined by .xsls files and performed by XSLScript as part of the site generation process.

The XML content is then combined with the corresponding XSLT file(s) that generates HTML in the libxslt directory.

flowchart
    direction LR
    subgraph make
        .xsls -->|XSLScript| .xslt
        subgraph xsltproc
            .xslt --> .html
            .xml ---> .html
        end
    end

Site generation is performed with make(1) with several targets, notably:

Docker image

Use the Dockerfile to create a self-container Docker image that approximates the production website.

docker build --no-cache -t nginx.org:my_build .

The docker image exposes port 8080 as per the convention for container hosting services.

Local development with Docker

Use Docker Compose to enable local development with a text editor (no other tools required). Site generation is performed within the Docker container whenever a change is made to the local files in the css, xml, and xsls directories.

Start the development container:

docker compose up --build --watch

Test the site by visiting localhost:8001.

Note: To keep the site generation time to a minimum, only the core HTML content is produced. Use the main Dockerfile for a complete build.

Local development with toolchain

Prerequisities

The static site generator uses a UNIX/Linux toolchain that includes:

macOS ships with all of the above with the exception of the netpbm tools. This can be installed with Homebrew if required.

Some Linux distros may also require the perl-dev or perl-utils package.

Windows TODO

Building the site content

With the prerequisites installed, run make from the top-level directory. This will create the libxslt directory with HTML content therein.

Running the website locally

Adapt the docker-nginx.conf file to suit your local nginx installation.

Authoring content

How pages are constructed

TODO

Making changes

Existing pages are edited by modifying the content in the xml directory. After making changes, run make from the top-level directory to regenerate the HTML.

Creating new pages

New pages should be created in the most appropriate location within a language directory, typically xml/en. The GNUmakefile must then be updated to reference the new page before it is included in the site generation process.

After determining the most appropriate location for the page, choose the most appropriate Document Type Definition (DTD) for your content. This will determine the page layout and the XML tags that are available for markup. The most likely candidates are:

Note that DTD files may include other DTDs, e.g. article.dtd includes content.dtd.

Style guide

Pay attention to existing files before making significant edits. The basic rules for XML content are: