This repository includes templates and JSON data for the FIT. python's jinja 2 is used to generate webpages from the html templates and JSON files (For R users, this approach is similar to using glue).
.json
files. Examples of json are available in the readme. If onboarding a new tool, the issue from the onboard-and-update repo should have a json based on user input that can be copy/pasted in, then checked.JSON data can be validated using schema.
See descriptions in the schema_model_list.json file.
Python and its libraries Jinja2
and requests
need to be installed locally.
pip install jinja2
pip install requests
From bash, run:
python create_tool_landing_page.py dev_config.json
python create_catalog_landing_page.py dev_config.json # or prod_config.json if building the production site.
python create_site_index_page.py dev_config.json # or prod_config.json if building the production site.
These are just the commands in create_html
.yml. Note that this will create new webpages that should NOT be saved to the repository.
To view the webpages from VS code, try using the Live Preview Extension. You may need to add .html to the end of a link in order to view it properly. Sometimes the embedded preview doesn't work, so a separate browser window will need to be opened instead.
GitHub actions code (YAML files) live in the .github/workflows
directory.
create_html.yml
: creates the html pages for viewing and saves them as artifacts. The files can be downloaded and examined. Runs on every push to any branch and manually.dev_create_website_and_deploy.yml
: updates FIT dev site by deploying rendered html from the toolbox_web_templating dev branch to https://github.com/noaa-fisheries-integrated-toolbox/fit-dev/tree/gh-pages (gh-pages branch). Runs on every push to the dev branch and manually.prod_create_website_and_deploy.yml
: updates FIT prod site by deploying rendered html from the toolbox_web_templating main branch to https://github.com/noaa-fisheries-integrated-toolbox/noaa-fisheries-integrated-toolbox.github.io/tree/gh-pages (gh-pages branch). runs on every push to main and manually.validate_json_config.yml
: check that prod_config.json
,dev_config.json
matches the JSON schema defined in schema_config.json
and that models_all.json
matches the JSON schema definied in schema_models_all.json
. If the GitHub action fails, it will provide info on how the json files need to be modified to match the schema. Runs on every push to any branch, and manually.validate_json_model_list.yml
: checks that the JSON files in model_list_dir
matches the JSON schema defined in schema_model_list.json
. If the GitHub action fails, it will provide info on how the json files need to be modified to match the schema. Runs on every push to any branch where there are changes to the files in model_list_dir
and manually.“The United States Department of Commerce (DOC) GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. DOC has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any claims against the Department of Commerce stemming from the use of its GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.”