|
| 1 | += Documentation Template |
| 2 | + |
| 3 | +This repo contains the files that you need to start a new Neo4j documentation project. |
| 4 | + |
| 5 | +== Prereqs |
| 6 | + |
| 7 | +- link:https://nodejs.org/en/download/[Node.js] |
| 8 | +- npm |
| 9 | + |
| 10 | +== Installation |
| 11 | + |
| 12 | +To install the required packages: |
| 13 | + |
| 14 | +---- |
| 15 | +npm i |
| 16 | +---- |
| 17 | + |
| 18 | +== Generating HTML output |
| 19 | + |
| 20 | +To convert asciidoc source to HTML: |
| 21 | + |
| 22 | +---- |
| 23 | +npm run build |
| 24 | +---- |
| 25 | + |
| 26 | +== Viewing HTML output |
| 27 | + |
| 28 | +To view the built site, launch a local server: |
| 29 | + |
| 30 | +1. `npm start` |
| 31 | +2. In a browser tab, go to `localhost:8000` |
| 32 | + |
| 33 | +== Live preview |
| 34 | + |
| 35 | +When you run `npm start`, the project is monitored for updates to asciidoc files. |
| 36 | + |
| 37 | +If a change to an asciidoc file is detected the site is automatically rebuilt. |
| 38 | + |
| 39 | +== Generating asciidoc source files |
| 40 | + |
| 41 | +If you are creating new documentation from scratch, creating all the asciidoc files can be time-consuming. |
| 42 | +This repo contains a script that you can use to save time by generating skeleton asciidoc files from your navigation. |
| 43 | + |
| 44 | +To use the script, first create your navigation file, or files if your doc set has more than one component. To use the script, all navigation files should have the filename `content-nav.adoc`. |
| 45 | +Then, to create the asciidoc source files, run `npm run adoc-gen`. |
| 46 | + |
| 47 | +For every file that is included as a list item entry in a `content-nav.adoc` file, an asciidoc file is created in the location specified. |
| 48 | +For example, if _modules/ROOT/content-nav.adoc_ includes `+++* xref:installation/introduction.adoc[]+++`, a file is created at _modules/ROOT/pages/installation/introduction.adoc_. |
| 49 | + |
| 50 | +The file contents consist of a comment to indicate that the file was generated by the script, and a top level title element. |
| 51 | +If title text is specified in the entry in the navigation file, that value will be used for the title in the generated file. |
| 52 | +If no title text is specified, the default title text is taken from the filename, formatted with sentence capitalization. |
| 53 | + |
| 54 | +== Configuring your project |
| 55 | + |
| 56 | +You'll need to update the following for your project |
| 57 | + |
| 58 | +=== antora.yml |
| 59 | + |
| 60 | +- `name:` - replace `docs-template` with the name of the project as it will appear in the URL https://neo4j.com/docs/<PROJECT_NAME>`, for example 'getting-started', 'cypher-manual'. |
| 61 | +- `title:` - the title of the manual, for example Getting Started Guide, Cypher Manual. This value is displayed in the breadcrumbs above each page. |
| 62 | +- `version:` - the version of the content that is generated from the branch containing this `antora.yml` file. |
| 63 | + |
| 64 | +Optionally, you can add the following attributes: |
| 65 | + |
| 66 | +- `display_version:` - Use this attribute when you want the version that is displayed in your content and in the UI to be different from the version that appears in the URL. For example, you might want to use _/2.0/_ in URLs, but display the version as `2.0-beta` in the version selector drop-down. |
| 67 | +- `prerelease:` - if you publish multiple versions of this project, you can mark a version as being a prerelease, by adding `prerelease: true`. The content is published alongside the other versions, but does not appear in the drop-down version selector, and is not included when Antora is calculating the default (or 'latest') version in order to resolve links between pages. For more information, see link:https://docs.antora.org/antora/latest/component-prerelease/[Antora // Docs -> Identify a Prerelease Version] |
| 68 | + |
| 69 | +=== preview.yml |
| 70 | + |
| 71 | +Antora uses a link:https://docs.antora.org/antora/latest/playbook/[playbook] to determine what content is included in a site, and the appearance of that content. |
| 72 | + |
| 73 | +In our projects, we use `preview.yml` as the default playbook name. |
| 74 | + |
| 75 | +Update the `start_page` attribute to match the value of the `name` attribute in your `antora.yml` file. |
| 76 | + |
| 77 | +---- |
| 78 | +site: |
| 79 | + start_page: docs-template:ROOT:index.adoc |
| 80 | +---- |
| 81 | + |
| 82 | +Update the information for the sitemap extension: |
| 83 | + |
| 84 | +---- |
| 85 | +antora: |
| 86 | + extensions: |
| 87 | + - require: "@neo4j-antora/antora-modify-sitemaps" |
| 88 | + sitemap_version: '1.0' |
| 89 | + sitemap_loc_version: 'current' |
| 90 | + move_sitemaps_to_components: true |
| 91 | +---- |
| 92 | + |
| 93 | +The link:https://www.npmjs.com/package/@neo4j-antora/antora-modify-sitemaps[`antora-modify-sitemaps`] Antora extension generates sitemaps for Neo4j docs that include information about the current release only, and makes sure those sitemaps are included in the right output folder when the HTML is built. |
| 94 | +In this example, a sitemap file would be generated at _build/site/docs-template/1.0/sitemap.xml_. |
| 95 | +Change the value of `sitemap_version` to the 'current' release version of your project. |
| 96 | +For example, Neo4j manuals such as the Getting Started Guide or Cypher Manual use 4.4 as their current version, so for those manuals this is set as `sitemap_version: '4.4`. |
| 97 | + |
| 98 | +=== [Optional] Add an 'Edit this page' link |
| 99 | + |
| 100 | +If your repo is public, you can add an `Edit this page` link to your pages to encourage external contributors, and to provide a quick way for users to suggest changes. |
| 101 | + |
| 102 | +Update the following attribute in your playbook: |
| 103 | + |
| 104 | +---- |
| 105 | +asciidoc: |
| 106 | + attributes: |
| 107 | + page-origin-private: false |
| 108 | +---- |
| 109 | + |
| 110 | +=== [Optional] Add a 'preview' note to each page |
| 111 | + |
| 112 | +When we publish preview content to either development or production environments, we prepend an admonition to every page to make it clear that this is preview content, for example, as in link:https://neo4j.com/docs/graph-data-science/2.0-preview/[Graph Data Science 2.0-preview]. |
| 113 | + |
| 114 | +You can use the link:https://www.npmjs.com/package/@neo4j-antora/antora-add-notes[antora-add-notes] extension to add content to your pages. |
| 115 | +Follow the Usage instructions in the package documentation. |
0 commit comments