Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing documentation on organization variables #9

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ $ bundle exec jekyll serve
The site is deployed onto Netlify via a continuous deployment process which just requires a push to the `main` branch to publish new changes.

When adding changes to the site, first open a pull request. Netlify will automatically deploy a separate site to preview the changes in the PR. Information on preview site, including URL, will be automatically added to the PR as a comment.

## Alternate environments

The documentation site can be customized for alternate environments by defining a new `_config-{env}.yml`. There are two primary steps to this process:

1. Define a new file `_config-{env}.yml`, where `{env}` is a short name for the environment (such as `dev`). In this file, define the environment-specific variables you want to override from the [default](_config.yml) configuration file.
2. Serve a local version of the site with the custom configuration by running the following, which will use the default configuration file and override with any variables defined in your custom configuration:

~~~bash
bundle exec jekyll serve -w --config _config.yml,_config-{env}.yml
~~~

A similar command can be used when **building** the site for deployment with a custom configuration:

~~~bash
bundle exec jekyll build -w --config _config.yml,_config-{env}.yml
~~~
4 changes: 2 additions & 2 deletions _api/enterprise_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ content_markdown: |-

left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/enterprise/:id
!API_URL!/enterprise/:id
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/enterprise/11111111
!API_URL!/enterprise/11111111
title: Example request
language: bash
right_code_blocks:
Expand Down
24 changes: 12 additions & 12 deletions _api/project_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,36 @@ content_markdown: |-

left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/project/:id
!API_URL!/project/:id
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/project/96666666
!API_URL!/project/96666666
title: Example request
language: bash
right_code_blocks:
- code_block: |2-
{
"reforestationCompanyName_fr": "WeForest",
"reforestationProjectImageURL_en": "https://www.weforest.org/sites/IMG_20190423_132725_0.jpg",
"reforestationCompanyName_en": "WeForest",
"reforestationCompanyName_fr": "OneTreePlanted",
"reforestationProjectImageURL_en": "https://cdn.shopify.com/s/files/1/0326/7189/products/india_aa36f63b-f455-4f5e-a6d3-2c0cc2d9936e_5000x.jpg?v=1636667460",
"reforestationCompanyName_en": "OneTreePlanted",
"reforestationProjectCountry_en": "India",
"reforestationCompanyAddress_en": "Ogentroostlaan 15, 3090 Overijse, Belgium",
"created": "2018-12-12T09:05:00.725Z",
"reforestationProjectWebsite_en": "https://www.weforest.org/project/india-khasi-hills",
"name": "Khasi Hills in India, WeForest",
"reforestationProjectWebsite_fr": "https://www.weforest.org/project/india-khasi-hills",
"reforestationProjectWebsite_en": "https://onetreeplanted.org/collections/asia/products/india",
"name": "Khasi Hills in India",
"reforestationProjectWebsite_fr": "https://onetreeplanted.org/collections/asia/products/india",
"reforestationProjectCountry_fr": "Inde",
"updated": "2019-05-19T19:24:10.761Z",
"reforestationProjectDescription_fr": "Projet de reforestation aux Khasi Hills en Inde",
"reforestationProjectDescription_en": "Reforestation project in the Khasi Hills in India",
"reforestationCompanyWebsite_fr": "https://www.weforest.org/",
"reforestationCompanyWebsite_en": "https://www.weforest.org/",
"reforestationCompanyWebsite_fr": "https://onetreeplanted.org/",
"reforestationCompanyWebsite_en": "https://onetreeplanted.org/",
"reforestationCompanyAddress_fr": "Ogentroostlaan 15, 3090 Overijse, Belgique",
"description": "Khasi Hills in India, WeForest",
"description": "Khasi Hills in India",
"id": "96666666",
"reforestationProjectImageURL_fr": "https://www.weforest.org/sites/default/IMG_20190423_132725_0.jpg"
"reforestationProjectImageURL_fr": "https://cdn.shopify.com/s/files/1/0326/7189/products/india_aa36f63b-f455-4f5e-a6d3-2c0cc2d9936e_5000x.jpg?v=1636667460"
}
title: Example Response
language: json
Expand Down
10 changes: 5 additions & 5 deletions _api/projects_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ content_markdown: |-

left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/project
!API_URL!/project
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/project
!API_URL!/project
title: Example request
language: bash
right_code_blocks:
Expand All @@ -49,12 +49,12 @@ right_code_blocks:
},
{
"id": "96666666",
"name": "Khasi Hills in India, WeForest",
"name": "Khasi Hills in India",
"reforestationProjectDescription_en": "Reforestation project in the Khasi Hills in India",
"reforestationProjectState_en": "Khasi Hills",
"reforestationProjectCountry_en": "India",
"reforestationProjectWebsite_en": "https://www.weforest.org/project/india-khasi-hills",
"reforestationCompanyName_en": "WeForest",
"reforestationProjectWebsite_en": "https://onetreeplanted.org/collections/asia/products/india",
"reforestationCompanyName_en": "OneTreePlanted",
}
]
title: Example response (with 2 reforestation projects included)
Expand Down
4 changes: 2 additions & 2 deletions _api/tree_get_enterprise_count.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ content_markdown: |-

left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/enterprise/:id/treeCount?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD
!API_URL!/enterprise/:id/treeCount?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/enterprise/11111111/treeCount?startDate=2010-03-01&endDate=2030-01-01
!API_URL!/enterprise/11111111/treeCount?startDate=2010-03-01&endDate=2030-01-01
title: Example request
language: bash
right_code_blocks:
Expand Down
4 changes: 2 additions & 2 deletions _api/tree_get_enterprise_month.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ content_markdown: |-
**count** Number of trees planted by the enterprise for a specific month
left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/enterprise/:id/treeCount/YYYY-MM
!API_URL!/enterprise/:id/treeCount/YYYY-MM
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/enterprise/11111111/treeCount/2020-02
!API_URL!/enterprise/11111111/treeCount/2020-02
title: Example request
language: bash
right_code_blocks:
Expand Down
4 changes: 2 additions & 2 deletions _api/tree_get_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ content_markdown: |-
**user** End user by whom the trees were planted (string)
left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/tree/:uuid-of-tree-planted
!API_URL!/tree/:uuid-of-tree-planted
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/tree/bcd35c97-d66c-412e-89ae-ecbac0f629ac
!API_URL!/tree/bcd35c97-d66c-412e-89ae-ecbac0f629ac
title: Example request
language: bash
right_code_blocks:
Expand Down
4 changes: 2 additions & 2 deletions _api/tree_get_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ content_markdown: |-
**count** Number of trees planted by a specific user
left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/tree?enterpriseId=:enterpriseId&user=:user
!API_URL!/tree?enterpriseId=:enterpriseId&user=:user
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/tree?enterpriseId=48a45261&user=test_user_1
!API_URL!/tree?enterpriseId=48a45261&user=test_user_1
title: Example request
language: bash
right_code_blocks:
Expand Down
4 changes: 2 additions & 2 deletions _api/tree_plant.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ content_markdown: |-

left_code_blocks:
- code_block: |-
https://api.digitalhumani.com/tree + Body Parameters described below
!API_URL!/tree + Body Parameters described below
title:
language: bash
right_request_blocks:
- code_block: |1-
https://api.digitalhumani.com/tree
!API_URL!/tree
Body parameters
{
"treeCount": 1,
Expand Down
3 changes: 2 additions & 1 deletion _appendix/list-of-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ position_number: 1
parameters:
- name:
content:
published: {{ site.is_DH }}
content_markdown: |-
Here is the complete list of available projects from our 6 reforestation partners. They are all available in all environments.

Expand Down Expand Up @@ -58,5 +59,5 @@ content_markdown: |-
| TIST | Kenya | 81818183 | program.tist.org/kenya |
| To be determined | Where they are needed most | 14442771 ||

Back to the main page of the RaaS (Reforestation as a Service) main page at [DigitalHumani.com](https://digitalhumani.com)
Back to the main page of the RaaS (Reforestation as a Service) main page at [!ORG_NAME!](!SITE_URL!)
---
12 changes: 12 additions & 0 deletions _config-otp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Override default configuration values with environment specific info
org_name: One Tree Planted
is_DH: false
base_url: https://docs.otp.digitalhumani.com
site_url: https://onetreeplanted.org # Marketing site
api_url: https://api.otp.digitalhumani.com
dashboard_url: https://otp.digitalhumani.com
dashboard_register_url: https://otp.digitalhumani.com/register
logo_url: https://assets.otp.digitalhumani.com/org/logo.svg
logo_css: "height: 75px"
support_email: [email protected]
intro_header: Welcome to the documentation for the [One Tree Planted](https://onetreeplanted.org/) API! It is a simple API for planting trees in One Tree Planted forestation projects. The API's base URL is [https://api.otp.digitalhumani.com](https://api.otp.digitalhumani.com).
30 changes: 20 additions & 10 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ google_analytics_key:
permalink: pretty
baseurl:

org_name: Digital Humani
is_DH: true
base_url: https://docs.digitalhumani.com # This site
site_url: https://digitalhumani.com # Marketing site
api_url: https://api.digitalhumani.com
dashboard_url: https://my.digitalhumani.com
dashboard_register_url: https://my.digitalhumani.com/register
logo_url: https://assets.dev.digitalhumani.com/org/logo.png
favicon_url: https://assets.dev.digitalhumani.com/org/favicon.ico
logo_css: "aspect-ratio: 1; width: 33%;"
sandbox_api: https://api.sandbox.digitalhumani.com/
sandbox_dashboard: https://my.sandbox.digitalhumani.com/
support_email: [email protected]
intro_header: Welcome to the documentation for the [Digital Humani](https://digitalhumani.com/) API! We refer to this service as **RaaS**, or "Reforestation as as Service". It is a simple API for planting trees with trusted reforestation organizations.

# -----
# Build

Expand All @@ -21,7 +36,7 @@ collections:
title: APIs
position_number: 2
appendix:
title: Appendix 1
title: Appendix
position_number: 3

plugins:
Expand All @@ -32,26 +47,21 @@ exclude:
- readme.md
- LICENSE
- vendor


defaults:
-
scope:
- scope:
path: ""
values:
layout: default
-
scope:
- scope:
type: "documentation"
values:
_hide_content: true
-
scope:
- scope:
type: "api"
values:
_hide_content: true
-
scope:
- scope:
type: "appendix"
values:
_hide_content: true
Expand Down
10 changes: 5 additions & 5 deletions _documentation/accessing-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ position_number: 2
parameters:
- name:
content:
published: false
content_markdown: |-
The API has two available endpoints:

**Production**
<br/>
[https://api.digitalhumani.com/](https://api.digitalhumani.com/)
[!API_URL!](!API_URL!)

**Sandbox**
<br/>
[https://api.sandbox.digitalhumani.com/](https://api.sandbox.digitalhumani.com/)
[!SANDBOX_URL!](!SANDBOX_URL!)

Each endpoint offers access to different environments. More information on the [Sandbox environment](/#documentationsandbox) available below.

---
---
2 changes: 1 addition & 1 deletion _documentation/billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ content_markdown: |-

Note: Some reforestation organizations request a minimum number of tree planting requests before providing an invoice, normally around 20 trees. If you do not end up planting 20 trees within a month, we normally just extend the billing period until you do hit the minimum.

This is a flexible process, and we're happy to help you through it - [reach out to us](mailto:[email protected]) with any questions you have.
This is a flexible process, and we're happy to help you through it - [reach out to us](mailto:!SUPPORT_EMAIL!) with any questions you have.


---
4 changes: 2 additions & 2 deletions _documentation/choose-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ parameters:
- name:
content:
content_markdown: |-
One of the most important first steps of planting trees is deciding where to plant them! We can help you with that process. DigitalHumani supports many great reforestation organizations around the world, so you can plant trees virtually anywhere.
One of the most important first steps of planting trees is deciding where to plant them! We can help you with that process. !ORG_NAME! supports many great reforestation organizations around the world, so you can plant trees virtually anywhere.

A full list of projects you can support is available via the API - see the [`GET /project`](/#apiprojects_list) request below.

Not sure where to start? We have a few suggestions:
- Shoot us [an email](mailto:info@digitalhumani.com). We're happy to discuss your options in more detail.
- Shoot us [an email](mailto:info@!SUPPORT_EMAIL!). We're happy to discuss your options in more detail.
- We've created a special project that plants trees *where they're needed most*. This will either defer the decision on where the trees are planted, or can be a temporary placeholder that can be updated to a different project later on. The ID for this project is *14442771*.

---
2 changes: 1 addition & 1 deletion _documentation/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
- name:
content:
content_markdown: |-
You can get started using the API by registering on the DigitalHumani dashboard at [https://my.digitalhumani.com/register](https://my.digitalhumani.com/register).
You can get started using the API by registering on the !ORG_NAME! dashboard at [!DASHBOARD_REGISTER_URL!](!DASHBOARD_REGISTER_URL!).

Once signed up, navigate to the *Developer* page to find your API key. You'll need that key to authenticate with the API. From that page, you'll also find your *enterpriseId* which will be useful in your API requests.

Expand Down
4 changes: 2 additions & 2 deletions _documentation/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ parameters:
- name:
content:
content_markdown: |-
Welcome to the documentation for the [DigitalHumani](https://digitalhumani.com) API! We refer to this service as **RaaS**, or "Reforestation as as Service". It is a simple API for planting trees with trusted reforestation organizations.
!INTRO_HEADER!

This is a *REST* API. All requests should be made over SSL, and all response bodies, including errors, are encoded in *JSON*. We likewise recommend that all requests be JSON encoded and include the `Content-Type: “application/json”` request header.

This documentation will include some high-level information on topics such as authentication and billing followed by detailed information on available API routes.

Got any questions, or looking something that's not specified in the docs? Feel free to shoot us a question at [[email protected]](mailto:[email protected]). We're here to help!
Got any questions, or looking something that's not specified in the docs? Feel free to shoot us a question at [!SUPPORT_EMAIL!](mailto:!SUPPORT_EMAIL!). We're here to help!

left_code_blocks:
- code_block:
Expand Down
3 changes: 2 additions & 1 deletion _documentation/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ position_number: 4
parameters:
- name:
content:
published: {{ site.is_DH }}
content_markdown: |-
After registration, you will have access to 2 separate environments: Sandbox and Production.

The Sandbox environment is used primarily for testing and getting familiar with the API. There are no costs associated with planting trees in Sandbox. Once you are ready to plant real trees, you should do so in the Production environment.

You can access the Sandbox dashboard by logging in at [https://my.sandbox.digitalhumani.com](https://my.sandbox.digitalhumani.com). Initially, you will have the same login credentials for both Production and Sandbox.
You can access the Sandbox dashboard by logging in at [!SANDBOX_DASHBOARD!](!SANDBOX_DASHBOARD!). Initially, you will have the same login credentials for both Production and Sandbox.

Note that you will have a separate API key in the Sandbox and Production environments. To access your API key, navigate to the *Developer* page.

Expand Down
1 change: 1 addition & 0 deletions _documentation/sdks-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ position_number: 7
parameters:
- name:
content:
published: {{ site.is_DH }}
content_markdown: |-
There are a number of integrations and SDKs available that you can use to easily integrate with the DigitalHumani API.

Expand Down
2 changes: 1 addition & 1 deletion _includes/syntax-highlight.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% capture highlight %}
``` {{ include.block.language }}
{{ include.block.code_block }}
{{ include.block.code_block | replace: "!API_URL!", site.api_url }}
```
{: title="{{ include.block.title }}" }
{% endcapture %}
Expand Down
Loading