diff --git a/README.md b/README.md index f56245ed..df23c9ea 100644 --- a/README.md +++ b/README.md @@ -121,37 +121,73 @@ instead. To embed an video simply type the following in markdown: ### Embedding ToS checkbox -A ToS acceptance checkbox can be added to any release page to gate binary -downloads behind a user acknowledgement. The feature is opt-in per page. +A ToS acceptance checkbox can be added to any page to gate binary downloads +and/or prose content behind a user acknowledgement. The feature is opt-in per +page. -**1. Add the checkbox macro** above the content you want to protect: +#### Gating download buttons + +Use the `tos_gated_downloads` macro and pass a unique `section_id` together +with the list of files. Use the **group format** to preserve subsection +headings matching the original release layout: ```md -{{ tos_checkbox("unique-section-id") }} +{{ tos_gated_downloads("vendor-board-vXYZ-binaries", [ + {"group": "Raw firmware image", "note": "(vendor_board_vX.Y.Z.rom)", "items": [ + {"label": "sha256", "url": "https://dl.3mdeb.com/.../file.rom.sha256"}, + {"label": "sha256.sig", "url": "https://dl.3mdeb.com/.../file.rom.sha256.sig"} + ]}, + {"group": "SBOM CycloneDX", "items": [ + {"label": "sbom.json", "url": "https://dl.3mdeb.com/.../file.sbom.json"}, + {"label": "sha256", "url": "https://dl.3mdeb.com/.../file.sbom.json.sha256"}, + {"label": "sha256.sig", "url": "https://dl.3mdeb.com/.../file.sbom.json.sha256.sig"} + ]} +]) }} ``` -**2. Wrap the protected content** in an HTML div with a matching `id`: +Download links are **not** emitted into the HTML source - they are +base64-encoded in a `data-payload` attribute and injected by `tos-gate.js` only +after the user checks the box. This keeps URLs out of page source and prevents +them from being indexed. + +Download buttons with groups example: +[`docs/variants/gigabyte_mz33-ar1/releases.md`][tos-example] + +#### Optional argument (`tos_url`) + +Overrides the default Terms of Service link: ```md -