Skip to content

Avoid overwriting base.html when the site config changes #147

Description

@isaisabel

As a maintainer of the ATT&CK website, changes to the overall site configuration (e.g banner message) should not change the content of base.html. In other words, this stuff should not be written to base.html based on the config whenever the build script runs.

  • Templates should not be overwritten by python scripts in general, rather they should pull dynamic data from fields in their markdown
  • Having the data in both the config and html makes maintainanace confusing to new users, who may change the version in base, not realizing it's overwritten from the config on build.
  • Changes to site config end up showing up as changes to base.html in git, leading to more work reviewing changes and during merges.

Instead of encoding site-wide config as variables in base.html, the config could write them as a siteconfig dict in every generated markdown file. Then, just like {% set parsed = page.data | from_json %} we can import the siteconfig in the base as {% set siteconfig = page.siteconfig | from_json %}.

The complicating factor is that there are some static pages that don't have dynamically generated markdown. And not all of them can easily be converted to dynamic markdown, for example the update logs contain actual content and can't easily be generated by a python script.

Metadata

Metadata

Assignees

Labels

timescale/short-termBecomes timescale/imminent in weeks or months

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions