|
1 | 1 | # Developer info for Public Website |
2 | 2 |
|
3 | | -Document here. |
| 3 | +## Setup |
| 4 | + |
| 5 | +In the `docs` directory run the following command: |
| 6 | + |
| 7 | +```bash |
| 8 | +make install |
| 9 | +``` |
| 10 | + |
| 11 | +This will install dependencies required by `Jekyll` and `npm`. On this install step we copy out `nhsuk.min.js` from `node_modules/nhsuk-frontend/dist`. |
| 12 | + |
| 13 | +## Running the application |
| 14 | + |
| 15 | +Run the following command to run the application in `debug` mode: |
| 16 | + |
| 17 | +```bash |
| 18 | +make debug |
| 19 | +``` |
| 20 | + |
| 21 | +When running the application in `debug` mode the `/examples` page is available. |
| 22 | + |
| 23 | +Run the following command to run the application in `production` mode: |
| 24 | + |
| 25 | +```bash |
| 26 | +make s |
| 27 | +``` |
| 28 | + |
| 29 | +## Writing content |
| 30 | + |
| 31 | +This project aims to keep content written in pure markdown with the exception of certain components supplied by the nhsuk design system. |
| 32 | + |
| 33 | +### Markdown and Jekyll Examples |
| 34 | + |
| 35 | +We have an `/examples/` page which aims to provide examples on how to use `markdown` and `Jekyll` together to display different components such as `actions-links`, `images with captions` and `tables`. |
| 36 | + |
| 37 | +The `/examples/` page is only available when the application is run in `debug` mode ([see Running the application](#running-the-application)). |
| 38 | + |
| 39 | +## Creating Jekyll include components |
| 40 | + |
| 41 | +To write a Jekyll component please follow the guidance in [Jekyll \_includes](https://jekyllrb.com/docs/includes/). We have also adopted a pattern to use [Jekyll liquid filters](https://jekyllrb.com/docs/liquid/filters/) to apply `escaping` and `encoding` to input variables notably; |
| 42 | + |
| 43 | +- `uri_escape` to escape any passed in URLS |
| 44 | +- `xml_escape` to encode any special characters being used on HTML attributes |
| 45 | + |
| 46 | +### Encoding special characters |
| 47 | + |
| 48 | +> This only applies to a `Jekyll component` in your markdown file. |
| 49 | +> At time of writing this doc (14/06/2024) all `Jekyll` components will encode values correctly. |
| 50 | +
|
| 51 | +When writing content you may need to `encode` special characters. What this means is for certain characters we need to use the encoded value: |
| 52 | + |
| 53 | +| Character | Encoded | Description | |
| 54 | +| --------- | -------- | ----------------- | |
| 55 | +| ' | `'` | Single quote | |
| 56 | +| " | `"` | Double quote | |
| 57 | +| < | `<` | Less than sign | |
| 58 | +| > | `>` | Greater than sign | |
| 59 | + |
| 60 | +The above table contains the main characters which could cause issues. A more extensive list can be found [here](https://psdtowp.net/html-codes-special-characters.html). |
| 61 | + |
| 62 | +## NHS styled Jekyll components |
| 63 | + |
| 64 | +Below is a list of the supported nhsuk [design system components](https://service-manual.nhs.uk/design-system/components) to use in `markdown` and `html` files. |
| 65 | + |
| 66 | +- [Image](_includes/components/docs/image.component.md) |
| 67 | +- [Action link](_includes/components/docs/action-link.component.md) |
| 68 | +- [Inset text](_includes/components/docs/inset-text.component.md) |
| 69 | + |
| 70 | +## Assets |
| 71 | + |
| 72 | +We have an assets folder which is used to put files such as; |
| 73 | + |
| 74 | +- favicons |
| 75 | +- images |
| 76 | +- Javascript |
| 77 | +- CSS |
| 78 | + |
| 79 | +If you have new images, favicons or other assets place them in the corresponding folder and the asset will be available via `/assets/<assert_type>/<asset_name>` for example `/assets/images/landing-main-image.svg`. |
0 commit comments