Skip to content

Commit

Permalink
Merge pull request #1059 from fermyon/tpmccallum-patch-16
Browse files Browse the repository at this point in the history
Document scheduling menu items for timed release
  • Loading branch information
Timothy McCallum authored Nov 28, 2023
2 parents e9df428 + 9bafe19 commit 8bd58fa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion content/spin/v2/contributing-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ keywords = "contribute contributing"
- [6.5 How To Properly Edit CSS Styles](#65-how-to-properly-edit-css-styles)
- [6.6 Checking Your Content - Using Bartholomew's CLI](#66-checking-your-content---using-bartholomews-cli)
- [6.7 Checking Your Content - Preview a Documentation Page on Localhost](#67-checking-your-content---preview-a-documentation-page-on-localhost)
- [6.8 Scheduling Menu Items for Timed Release](#68-scheduling-menu-items-for-timed-release)
- [7. Checking Web Pages](#7-checking-web-pages)
- [8. Add Changes](#8-add-changes)
- [9. Commit Changes](#9-commit-changes)
Expand Down Expand Up @@ -439,7 +440,21 @@ $ spin build
$ spin up -e "PREVIEW_MODE=1"
```

> Please note: using the `PREVIEW_MODE=1` as part of a `spin` command is safe on localhost and allows you to view content (even if the `date` setting in the content's `.md` is set to a future date). It is often the case that you will be checking content before the publishing date via your system. The developer documentation's manifest file `spin.toml` has the `PREVIEW_MODE` set to `0` i.e. `environment = { PREVIEW_MODE = "0" }`. This `spin.toml` file is correct for a production environment and should always be `0` (so that the CMS adheres to the publishing `date` setting for content on the public site). Simply put, you can use `PREVIEW_MODE=1` safely in your command line on your locahost but you should never update the `spin.toml` file (in this regard).
> Please note: using the `PREVIEW_MODE=1` as part of a `spin` command is safe on localhost and allows you to view the content (even if the `date` setting in the content's `.md` is set to a future date). It is often the case that you will be checking content before the publishing date via your system. The developer documentation's manifest file `spin.toml` has the `PREVIEW_MODE` set to `0` i.e. `environment = { PREVIEW_MODE = "0" }`. This `spin.toml` file is correct for a production environment and should always be `0` (so that the CMS adheres to the publishing `date` setting for content on the public site). Simply put, you can use `PREVIEW_MODE=1` safely in your command line on your localhost but you should never update the `spin.toml` file (in this regard).
### 6.8 Scheduling Menu Items for Timed Release

As mentioned above, all pages (`.md` files) in the documentation have a UTC date i.e. `date = "2023-07-25T17:26:00Z"`. The `date` is a page scheduling mechanism whereby each page is only displayed if the `date` has elapsed. Menu items (found in the `/developer/templates/*.hbs` files) that relate to a scheduled page can also be scheduled (so the specific menu item and its associated page appear at the same time). Simply envelope the menu item with the following `if` syntax to synchronize the appearance of the menu item with the related page:

<!-- @nocpy -->

```
{{#if (timed_publish "2023-07-25T17:26:00Z" env.PREVIEW_MODE)}}
// Scheduled menu item for timed release
{{/if}}
```

> In order to keep the code tidy and readable it is advised to remove the `if` logic (from the `.hbs` file) that wraps the content, once the `timed_publish` has elapsed.
### 7. Checking Web Pages

Expand Down

0 comments on commit 8bd58fa

Please sign in to comment.