• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

components/H26-Aug-2021-942813

content/H26-Aug-2021-97,52873,994

data/H03-May-2022-2,5992,593

pages/H03-May-2022-1,6291,475

public/H03-May-2022-

scripts/H03-May-2022-146

.editorconfigH A D26-Aug-2021314 1914

.envH A D26-Aug-2021151 43

.env.productionH A D26-Aug-202121 21

.gitignoreH A D26-Aug-2021185 108

DockerfileH A D26-Aug-2021273 86

MakefileH A D26-Aug-20211.6 KiB5746

README.mdH A D26-Aug-202123.6 KiB489344

jsconfig.jsonH A D26-Aug-202197 76

next-env.d.tsH A D26-Aug-202175 30

package-lock.jsonH A D26-Aug-2021696.3 KiB17,09417,093

package.jsonH A D26-Aug-20212.2 KiB6463

tsconfig.jsonH A D26-Aug-2021553 3130

vercel.jsonH A D26-Aug-202175 87

README.md

1# Vault Website
2
3This subdirectory contains the entire source for the [Vault Website](https://vaultproject.io/). This is a [NextJS](https://nextjs.org/) project, which builds a static site from these source files.
4
5<!--
6  This readme file contains several blocks of generated text, to make it easier to share common information
7  across documentation website readmes. To generate these blocks from their source, run `npm run generate:readme`
8
9  Any edits to the readme are welcome outside the clearly noted boundaries of the blocks. Alternately, a
10  block itself can be safely "forked" from the central implementation simply by removing the "BEGIN" and
11  "END" comments from around it.
12-->
13
14## Table of Contents
15
16- [Contributions](#contributions-welcome)
17- [Running the Site Locally](#running-the-site-locally)
18- [Editing Markdown Content](#editing-markdown-content)
19- [Editing Navigation Sidebars](#editing-navigation-sidebars)
20- [Changing the Release Version](#changing-the-release-version)
21- [Redirects](#redirects)
22- [Browser Support](#browser-support)
23- [Deployment](#deployment)
24
25<!-- BEGIN: contributions -->
26<!-- Generated text, do not edit directly -->
27
28## Contributions Welcome!
29
30If you find a typo or you feel like you can improve the HTML, CSS, or JavaScript, we welcome contributions. Feel free to open issues or pull requests like any normal GitHub project, and we'll merge it in ��
31
32<!-- END: contributions -->
33
34<!-- BEGIN: local-development -->
35<!-- Generated text, do not edit directly -->
36
37## Running the Site Locally
38
39The website can be run locally through node.js or [Docker](https://www.docker.com/get-started). If you choose to run through Docker, everything will be a little bit slower due to the additional overhead, so for frequent contributors it may be worth it to use node.
40
41> **Note:** If you are using a text editor that uses a "safe write" save style such as **vim** or **goland**, this can cause issues with the live reload in development. If you turn off safe write, this should solve the problem. In vim, this can be done by running `:set backupcopy=yes`. In goland, search the settings for "safe write" and turn that setting off.
42
43### With Docker
44
45Running the site locally is simple. Provided you have Docker installed, clone this repo, run `make`, and then visit `http://localhost:3000`.
46
47The docker image is pre-built with all the website dependencies installed, which is what makes it so quick and simple, but also means if you need to change dependencies and test the changes within Docker, you'll need a new image. If this is something you need to do, you can run `make build-image` to generate a local Docker image with updated dependencies, then `make website-local` to use that image and preview.
48
49### With Node
50
51If your local development environment has a supported version (v10.0.0+) of [node installed](https://nodejs.org/en/) you can run:
52
53- `npm install`
54- `npm start`
55
56...and then visit `http://localhost:3000`.
57
58If you pull down new code from github, you should run `npm install` again. Otherwise, there's no need to re-run `npm install` each time the site is run, you can just run `npm start` to get it going.
59
60<!-- END: local-development -->
61
62<!-- BEGIN: editing-markdown -->
63<!-- Generated text, do not edit directly -->
64
65## Editing Markdown Content
66
67Documentation content is written in [Markdown](https://www.markdownguide.org/cheat-sheet/) and you'll find all files listed under the `/content` directory.
68
69To create a new page with Markdown, create a file ending in `.mdx` in a `content/<subdirectory>`. The path in the content directory will be the URL route. For example, `content/docs/hello.mdx` will be served from the `/docs/hello` URL.
70
71> **Important**: Files and directories will only be rendered and published to the website if they are [included in sidebar data](#editing-navigation-sidebars). Any file not included in sidebar data will not be rendered or published.
72
73This file can be standard Markdown and also supports [YAML frontmatter](https://middlemanapp.com/basics/frontmatter/). YAML frontmatter is optional, there are defaults for all keys.
74
75```yaml
76---
77title: 'My Title'
78description: "A thorough, yet succinct description of the page's contents"
79---
80
81```
82
83The significant keys in the YAML frontmatter are:
84
85- `title` `(string)` - This is the title of the page that will be set in the HTML title.
86- `description` `(string)` - This is a description of the page that will be set in the HTML description.
87
88> ⚠️ If there is a need for a `/api/*` url on this website, the url will be changed to `/api-docs/*`, as the `api` folder is reserved by next.js.
89
90### Creating New Pages
91
92There is currently a small bug with new page creation - if you create a new page and link it up via subnav data while the server is running, it will report an error saying the page was not found. This can be resolved by restarting the server.
93
94### Markdown Enhancements
95
96There are several custom markdown plugins that are available by default that enhance [standard markdown](https://commonmark.org/) to fit our use cases. This set of plugins introduces a couple instances of custom syntax, and a couple specific pitfalls that are not present by default with markdown, detailed below:
97
98- If you see the symbols `~>`, `->`, `=>`, or `!>`, these represent [custom alerts](https://github.com/hashicorp/remark-plugins/tree/master/plugins/paragraph-custom-alerts#paragraph-custom-alerts). These render as colored boxes to draw the user's attention to some type of aside.
99- If you see `@include '/some/path.mdx'`, this is a [markdown include](https://github.com/hashicorp/remark-plugins/tree/master/plugins/include-markdown#include-markdown-plugin). It's worth noting as well that all includes resolve from `website/content/partials` by default, and that changes to partials will not live-reload the website.
100- If you see `# Headline ((#slug))`, this is an example of an [anchor link alias](https://github.com/hashicorp/remark-plugins/tree/je.anchor-link-adjustments/plugins/anchor-links#anchor-link-aliases). It adds an extra permalink to a headline for compatibility and is removed from the output.
101- Due to [automatically generated permalinks](https://github.com/hashicorp/remark-plugins/tree/je.anchor-link-adjustments/plugins/anchor-links#anchor-links), any text changes to _headlines_ or _list items that begin with inline code_ can and will break existing permalinks. Be very cautious when changing either of these two text items.
102
103  Headlines are fairly self-explanitory, but here's an example of how list items that begin with inline code look.
104
105  ```markdown
106  - this is a normal list item
107  - `this` is a list item that begins with inline code
108  ```
109
110  Its worth noting that _only the inline code at the beginning of the list item_ will cause problems if changed. So if you changed the above markup to...
111
112  ```markdown
113  - lsdhfhksdjf
114  - `this` jsdhfkdsjhkdsfjh
115  ```
116
117  ...while it perhaps would not be an improved user experience, no links would break because of it. The best approach is to **avoid changing headlines and inline code at the start of a list item**. If you must change one of these items, make sure to tag someone from the digital marketing development team on your pull request, they will help to ensure as much compatibility as possible.
118
119### Custom Components
120
121A number of custom [mdx components](https://mdxjs.com/) are available for use within any `.mdx` file. Each one is documented below:
122
123#### Tabs
124
125The `Tabs` component creates tabbed content of any type, but is often used for code examples given in different languages. Here's an example of how it looks from the Vagrant documentation website:
126
127![Tabs Component](https://p176.p0.n0.cdn.getcloudapp.com/items/WnubALZ4/Screen%20Recording%202020-06-11%20at%2006.03%20PM.gif?v=1de81ea720a8cc8ade83ca64fb0b9edd)
128
129> Please refer to the [Swingset](https://react-components.vercel.app/?component=Tabs) documention for the latest examples and API reference.
130
131It can be used as such within a markdown file:
132
133````mdx
134Normal **markdown** content.
135
136<Tabs>
137<Tab heading="CLI command">
138            <!-- Intentionally skipped line.. -->
139```shell-session
140$ command ...
141```
142            <!-- Intentionally skipped line.. -->
143</Tab>
144<Tab heading="API call using cURL">
145
146```shell-session
147$ curl ...
148```
149
150</Tab>
151</Tabs>
152
153Contined normal markdown content
154````
155
156The intentionally skipped line is a limitation of the mdx parser which is being actively worked on. All tabs must have a heading, and there is no limit to the number of tabs, though it is recommended to go for a maximum of three or four.
157
158#### Enterprise Alert
159
160This component provides a standard way to call out functionality as being present only in the enterprise version of the software. It can be presented in two contexts, inline or standalone. Here's an example of standalone usage from the Consul docs website:
161
162![Enterprise Alert Component - Standalone](https://p176.p0.n0.cdn.getcloudapp.com/items/WnubALp8/Screen%20Shot%202020-06-11%20at%206.06.03%20PM.png?v=d1505b90bdcbde6ed664831a885ea5fb)
163
164The standalone component can be used as such in markdown files:
165
166```mdx
167# Page Headline
168
169<EnterpriseAlert />
170
171Continued markdown content...
172```
173
174It can also receive custom text contents if you need to change the messaging but wish to retain the style. This will replace the text `This feature is available in all versions of Consul Enterprise.` with whatever you add. For example:
175
176```mdx
177# Page Headline
178
179<EnterpriseAlert>
180  My custom text here, and <a href="#">a link</a>!
181</EnterpriseAlert>
182
183Continued markdown content...
184```
185
186It's important to note that once you are adding custom content, it must be html and can not be markdown, as demonstrated above with the link.
187
188Now let's look at inline usage, here's an example:
189
190![Enterprise Alert Component - Inline](https://p176.p0.n0.cdn.getcloudapp.com/items/L1upYLEJ/Screen%20Shot%202020-06-11%20at%206.07.50%20PM.png?v=013ba439263de8292befbc851d31dd78)
191
192And here's how it could be used in your markdown document:
193
194```mdx
195### Some Enterprise Feature <EnterpriseAlert inline />
196
197Continued markdown content...
198```
199
200It's also worth noting that this component will automatically adjust to the correct product colors depending on the context.
201
202#### Other Components
203
204Other custom components can be made available on a per-site basis, the above are the standards. If you have questions about custom components that are not documented here, or have a request for a new custom component, please reach out to @hashicorp/digital-marketing.
205
206### Syntax Highlighting
207
208When using fenced code blocks, the recommendation is to tag the code block with a language so that it can be syntax highlighted. For example:
209
210````
211```
212// BAD: Code block with no language tag
213```
214
215```javascript
216// GOOD: Code block with a language tag
217```
218````
219
220Check out the [supported languages list](https://prismjs.com/#supported-languages) for the syntax highlighter we use if you want to double check the language name.
221
222It is also worth noting specifically that if you are using a code block that is an example of a terminal command, the correct language tag is `shell-session`. For example:
223
224��**BAD**: Using `shell`, `sh`, `bash`, or `plaintext` to represent a terminal command
225
226````
227```shell
228$ terraform apply
229```
230````
231
232✅**GOOD**: Using `shell-session` to represent a terminal command
233
234````
235```shell-session
236$ terraform apply
237```
238````
239
240<!-- END: editing-markdown -->
241
242<!-- BEGIN: editing-docs-sidebars -->
243<!-- Generated text, do not edit directly -->
244
245## Editing Navigation Sidebars
246
247The structure of the sidebars are controlled by files in the [`/data` directory](data). For example, [data/docs-nav-data.json](data/docs-nav-data.json) controls the **docs** sidebar. Within the `data` folder, any file with `-nav-data` after it controls the navigation for the given section.
248
249The sidebar uses a simple recursive data structure to represent _files_ and _directories_. The sidebar is meant to reflect the structure of the docs within the filesystem while also allowing custom ordering. Let's look at an example. First, here's our example folder structure:
250
251```text
252.
253├── docs
254│   └── directory
255│       ├── index.mdx
256│       ├── file.mdx
257│       ├── another-file.mdx
258│       └── nested-directory
259│           ├── index.mdx
260│           └── nested-file.mdx
261```
262
263Here's how this folder structure could be represented as a sidebar navigation, in this example it would be the file `website/data/docs-nav-data.json`:
264
265```json
266[
267  {
268    "title": "Directory",
269    "routes": [
270      {
271        "title": "Overview",
272        "path": "directory"
273      },
274      {
275        "title": "File",
276        "path": "directory/file"
277      },
278      {
279        "title": "Another File",
280        "path": "directory/another-file"
281      },
282      {
283        "title": "Nested Directory",
284        "routes": [
285          {
286            "title": "Overview",
287            "path": "directory/nested-directory"
288          },
289          {
290            "title": "Nested File",
291            "path": "directory/nested-directory/nested-file"
292          }
293        ]
294      }
295    ]
296  }
297]
298```
299
300A couple more important notes:
301
302- Within this data structure, ordering is flexible, but hierarchy is not. The structure of the sidebar must correspond to the structure of the content directory. So while you could put `file` and `another-file` in any order in the sidebar, or even leave one or both of them out, you could not decide to un-nest the `nested-directory` object without also un-nesting it in the filesystem.
303- The `title` property on each node in the `nav-data` tree is the human-readable name in the navigation.
304- The `path` property on each leaf node in the `nav-data` tree is the URL path where the `.mdx` document will be rendered, and the
305- Note that "index" files must be explicitly added. These will be automatically resolved, so the `path` value should be, as above, `directory` rather than `directory/index`. A common convention is to set the `title` of an "index" node to be `"Overview"`.
306
307Below we will discuss a couple of more unusual but still helpful patterns.
308
309### Index-less Categories
310
311Sometimes you may want to include a category but not have a need for an index page for the category. This can be accomplished, but as with other branch and leaf nodes, a human-readable `title` needs to be set manually. Here's an example of how an index-less category might look:
312
313```text
314.
315├── docs
316│   └── indexless-category
317│       └── file.mdx
318```
319
320```json
321// website/data/docs-nav-data.json
322[
323  {
324    "title": "Indexless Category",
325    "routes": [
326      {
327        "title": "File",
328        "path": "indexless-category/file"
329      }
330    ]
331  }
332]
333```
334
335### Custom or External Links
336
337Sometimes you may have a need to include a link that is not directly to a file within the docs hierarchy. This can also be supported using a different pattern. For example:
338
339```json
340[
341  {
342    "name": "Directory",
343    "routes": [
344      {
345        "title": "File",
346        "path": "directory/file"
347      },
348      {
349        "title": "Another File",
350        "path": "directory/another-file"
351      },
352      {
353        "title": "Tao of HashiCorp",
354        "href": "https://www.hashicorp.com/tao-of-hashicorp"
355      }
356    ]
357  }
358]
359```
360
361If the link provided in the `href` property is external, it will display a small icon indicating this. If it's internal, it will appear the same way as any other direct file link.
362
363<!-- END: editing-docs-sidebars -->
364
365<!-- BEGIN: releases -->
366<!-- Generated text, do not edit directly -->
367
368## Changing the Release Version
369
370To change the version displayed for download on the website, head over to `data/version.js` and change the number there. It's important to note that the version number must match a version that has been released and is live on `releases.hashicorp.com` -- if it does not, the website will be unable to fetch links to the binaries and will not compile. So this version number should be changed _only after a release_.
371
372### Displaying a Prerelease
373
374If there is a prerelease of any type that should be displayed on the downloads page, this can be done by editing `pages/downloads/index.jsx`. By default, the download component might look something like this:
375
376```jsx
377<ProductDownloader
378  product="<Product>"
379  version={VERSION}
380  downloads={downloadData}
381  community="/resources"
382/>
383```
384
385To add a prerelease, an extra `prerelease` property can be added to the component as such:
386
387```jsx
388<ProductDownloader
389  product="<Product>"
390  version={VERSION}
391  downloads={downloadData}
392  community="/resources"
393  prerelease={{
394    type: 'release candidate', // the type of prerelease: beta, release candidate, etc.
395    name: 'v1.0.0', // the name displayed in text on the website
396    version: '1.0.0-rc1', // the actual version tag that was pushed to releases.hashicorp.com
397  }}
398/>
399```
400
401This configuration would display something like the following text on the website, emphasis added to the configurable parameters:
402
403```
404A {{ release candidate }} for <Product> {{ v1.0.0 }} is available! The release can be <a href='https://releases.hashicorp.com/<product>/{{ 1.0.0-rc1 }}'>downloaded here</a>.
405```
406
407You may customize the parameters in any way you'd like. To remove a prerelease from the website, simply delete the `prerelease` paremeter from the above component.
408
409<!-- END: releases -->
410
411<!-- BEGIN: redirects -->
412<!-- Generated text, do not edit directly -->
413
414## Redirects
415
416This website structures URLs based on the filesystem layout. This means that if a file is moved, removed, or a folder is re-organized, links will break. If a path change is necessary, it can be mitigated using redirects. It's important to note that redirects should only be used to cover for external links -- if you are moving a path which internal links point to, the internal links should also be adjusted to point to the correct page, rather than relying on a redirect.
417
418To add a redirect, head over to the `redirects.js` file - the format is fairly simple - there's a `source` and a `destination` - fill them both in, indicate that it's a permanent redirect or not using the `permanent` key, and that's it. Let's look at an example:
419
420```
421{
422  source: '/foo',
423  destination: '/bar',
424  permanent: true
425}
426```
427
428This redirect rule will send all incoming links to `/foo` to `/bar`. For more details on the redirects file format, [check out the docs on vercel](https://vercel.com/docs/configuration#project/redirects). All redirects will work both locally and in production exactly the same way, so feel free to test and verify your redirects locally. In the past testing redirects has required a preview deployment -- this is no longer the case. Please note however that if you add a redirect while the local server is running, you will need to restart it in order to see the effects of the redirect.
429
430There is still one caveat though: redirects do not apply to client-side navigation. By default, all links in the navigation and docs sidebar will navigate purely on the client side, which makes navigation through the docs significantly faster, especially for those with low-end devices and/or weak internet connections. In the future, we plan to convert all internal links within docs pages to behave this way as well. This means that if there is a link on this website to a given piece of content that has changed locations in some way, we need to also _directly change existing links to the content_. This way, if a user clicks a link that navigates on the client side, or if they hit the url directly and the page renders from the server side, either one will work perfectly.
431
432Let's look at an example. Say you have a page called `/docs/foo` which needs to be moved to `/docs/nested/foo`. Additionally, this is a page that has been around for a while and we know there are links into `/docs/foo.html` left over from our previous website structure. First, we move the page, then adjust the docs sidenav, in `data/docs-navigation.js`. Find the category the page is in, and move it into the appropriate subcategory. Next, we add to `_redirects` as such. The `.html` version is covered automatically.
433
434```js
435{ source: '/foo', destination: '/nested/foo', permanent: true }
436```
437
438Next, we run a global search for internal links to `/foo`, and make sure to adjust them to be `/nested/foo` - this is to ensure that client-side navigation still works correctly. _Adding a redirect alone is not enough_.
439
440One more example - let's say that content is being moved to an external website. A common example is guides moving to `learn.hashicorp.com`. In this case, we take all the same steps, except that we need to make a different type of change to the `docs-navigation` file. If previously the structure looked like:
441
442```js
443{
444  category: 'docs',
445  content: [
446    'foo'
447  ]
448}
449```
450
451If we no longer want the link to be in the side nav, we can simply remove it. If we do still want the link in the side nav, but pointing to an external destnation, we need to slightly change the structure as such:
452
453```js
454{
455  category: 'docs',
456  content: [
457    { title: 'Foo Title', href: 'https://learn.hashicorp.com/<product>/foo' }
458  ]
459}
460```
461
462As the majority of items in the side nav are internal links, the structure makes it as easy as possible to represent these links. This alternate syntax is the most concise manner than an external link can be represented. External links can be used anywhere within the docs sidenav.
463
464It's also worth noting that it is possible to do glob-based redirects, for example matching `/docs/*`, and you may see this pattern in the redirects file. This type of redirect is much higher risk and the behavior is a bit more nuanced, so if you need to add a glob redirect, please reach out to the website maintainers and ask about it first.
465
466<!-- END: redirects -->
467
468<!-- BEGIN: browser-support -->
469<!-- Generated text, do not edit directly -->
470
471## Browser Support
472
473We support the following browsers targeting roughly the versions specified.
474
475| ![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_24x24.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_24x24.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_24x24.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_24x24.png) | ![Internet Explorer](https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_24x24.png) |
476| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
477| **Latest**                                                                                          | **Latest**                                                                                             | **Latest**                                                                                       | **Latest**                                                                                          | **11+**                                                                                                    |
478
479<!-- END: browser-support -->
480
481<!-- BEGIN: deployment -->
482<!-- Generated text, do not edit directly -->
483
484## Deployment
485
486This website is hosted on Vercel and configured to automatically deploy anytime you push code to the `stable-website` branch. Any time a pull request is submitted that changes files within the `website` folder, a deployment preview will appear in the github checks which can be used to validate the way docs changes will look live. Deployments from `stable-website` will look and behave the same way as deployment previews.
487
488<!-- END: deployment -->
489