Skip to content

Docs for new feature custom templates in Studio#2644

Merged
acn-sbuad merged 20 commits intomasterfrom
docs/custom-template
Mar 17, 2026
Merged

Docs for new feature custom templates in Studio#2644
acn-sbuad merged 20 commits intomasterfrom
docs/custom-template

Conversation

@acn-sbuad
Copy link
Copy Markdown
Contributor

@acn-sbuad acn-sbuad commented Jan 23, 2026

  • Documentation for new feature
  • Added new shortcode for validation of json against json schema (provided via url)

Summary by CodeRabbit

  • Documentation

    • Added comprehensive English and Norwegian guides for manually setting up custom templates, covering repository layout, manifest and template requirements, validation guidance, content layout, examples, a setup checklist, and best practices.
  • New Features

    • Added an interactive JSON Schema validator for documentation pages and conditional loading so the validator script is included only when a page uses it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 23, 2026

Warning

Rate limit exceeded

@acn-sbuad has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_resolve_threads'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds English and Norwegian Bokmål guides for manual custom-template setup, a new Hugo shortcode that provides an interactive JSON Schema validator, and theme changes to load an AJV bundle conditionally when the validator is present. (Note: no Norwegian Nynorsk document was added.)

Changes

Cohort / File(s) Summary
Custom Template Documentation
content/altinn-studio/v8/guides/development/custom-templates/_index.en.md, content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md
New guides describing repository layout, required files (templatemanifest.json, template.json, content/), example JSON and schemas, validation guidance, recursive content copy behavior, setup checklist, and best practices.
JSON Schema Validator Shortcode
themes/hugo-theme-altinn/layouts/shortcodes/jsonschema-validator.html
New Hugo shortcode that renders an interactive JSON Schema validator UI (textarea, Validate button, results). Sets needsAjv, accepts schemaUrl/label params, fetches and compiles schema with AJV (allErrors: true, strict: false), validates input, and displays formatted errors or success with error handling.
Theme Layout & AJV Loader Partial
themes/hugo-theme-altinn/layouts/_default/list.html, themes/hugo-theme-altinn/layouts/partials/ajv.html
list.html updated to conditionally include the ajv.html partial when needsAjv is set; ajv.html added to include the /js/ajv.bundle.js script.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Browser
    participant Page
    participant AJV
    participant SchemaHost

    User->>Browser: Open page with validator shortcode
    Browser->>Page: Load rendered HTML (validator UI present, needsAjv set)
    Page-->>Browser: Render textarea, Validate button, results area
    Browser->>Page: Detects needsAjv -> loads `/js/ajv.bundle.js`
    Browser->>AJV: Initialize AJV instance
    Browser->>SchemaHost: Fetch schema from schemaUrl
    SchemaHost-->>Browser: Return schema JSON
    Browser->>AJV: Compile schema (allErrors: true, strict: false)
    User->>Browser: Enter JSON and click Validate
    Browser->>AJV: Validate JSON
    alt valid
        AJV-->>Browser: No errors
        Browser->>User: Display success
    else invalid
        AJV-->>Browser: Error list
        Browser->>User: Display formatted errors
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A guide in English and Bokmål appear,
AJV waits to chase the schema fear,
Paste your JSON, click to see,
Errors shown or green-lit tree,
Templates ready — documentation near. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changeset: documentation for a new custom templates feature in Altinn Studio, including guides and a JSON Schema validator shortcode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/custom-template

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 60-64: Update the third requirement bullet to tighten label
formatting and add the English label: change "`name` and `description` must
include entries for `nb`(norsk bokmål)." to include a space before the
parenthesis and an English label, e.g. "`name` and `description` must include
entries for `nb` (Norsk bokmål) and `en` (English)." Ensure the wording matches
this format and correct capitalization/spacing.

In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 7-8: The sentence starting "tilpassede maler lar organisasjoner
lage gjenbrukbare applikasjonsmaler." should begin with a capital letter; change
the leading "tilpassede" to "Tilpassede" in the document (the sentence that
currently reads "tilpassede maler..." in the Markdown content). Ensure the same
capitalization rule is applied if the identical sentence appears elsewhere in
this file.
- Around line 14-30: The code fences in the markdown lack language tags and a
bare shortcode URL triggers MD034; update each fenced block around the directory
trees to use a language tag (e.g., ```text) and add an HTML markdownlint-disable
comment immediately before the shortcode instance {{< jsonschema-validator ...
>}} (<!-- markdownlint-disable-next-line MD034 -->) to silence the bare URL
rule; apply the same changes to the other occurrences mentioned (around
Templates/min-mal/content/ and the other noted blocks) so all code fences are
labeled and all shortcode lines are prefixed with the MD034 suppression.

Comment thread content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md Outdated
Comment thread content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md Outdated
acn-sbuad and others added 5 commits January 23, 2026 15:29
…index.nb.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…index.en.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Updated the content structure examples in the custom templates guide.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 106-117: The code block is incorrectly labeled as JSON and
contains inconsistent tree glyphs and a stray '|' character; change the fence
language from ```json to ```text, replace the ASCII '|' with the Unicode
box-drawing vertical bar '│' for alignment, and fix the misindented branch so
lines using "├──", "│", and "└──" form a consistent tree (ensure the "config/"
entry uses "│   ├── config/" and "│   │   └── applicationmetadata.json"
formatting to match the other nodes).

In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 106-117: Ret Rett opp tegnene i trevisningen under
"Templates/min-mal/content/" ved å erstatte alle forekomster av pipe-tegnet '|'
med det grafiske vertikale tegnet '│' og juster innrykkene slik at alle nivåer
bruker samme tegntype og avstand (f.eks. linjene for App/, models/, ui/,
layouts/, Settings.json, logic/, config/, applicationmetadata.json og
README.md). Sørg for konsekvent bruk av '│' for alle mellomnivåer og samme
antall mellomrom før hver gren for å få et jevnt og korrekt tre.
♻️ Duplicate comments (2)
content/altinn-studio/v8/guides/development/custom-templates/_index.en.md (1)

60-63: Language label requirement still reads incomplete.

Same issue as previously noted: the requirement only mentions nb and formatting could be clearer. Please align with the earlier suggestion to include English and spacing.

content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md (1)

97-97: Bare URL in shortcode still triggers MD034.

Same markdownlint issue as previously flagged; add the MD034 suppression comment immediately above the shortcode.

Comment thread content/altinn-studio/v8/guides/development/custom-templates/_index.en.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 106-117: The ASCII tree uses the end-child marker incorrectly:
`logic/` is marked with `└──` but `config/` is listed as a sibling beneath it;
update the tree so only the actual last child at each level uses `└──`. Locate
the block showing Templates/my-template/content and adjust the markers so either
`logic/` is not `└──` (use `├──`) and `config/` remains a sibling, or make
`config/` the final sibling and keep `logic/` as `├──`, ensuring the indentation
and branch characters for `App/` -> `logic/` -> `config/` reflect the correct
parent/child relationships.

In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 106-117: The ASCII tree in the doc has inconsistent branch
markers: `logic/` is shown with a terminal marker `└──` while `config/` is added
as a sibling underneath; update the tree so branch characters reflect the actual
nesting (use `├──` for intermediate siblings and `└──` only for the last child)
— adjust the entries under "Templates/min-mal/content/" (entries `App/`,
`models/`, `ui/`, `layouts/`, `Settings.json`, `logic/`, `config/`,
`applicationmetadata.json`, `README.md`) so their `└──`/`├──` markers correctly
represent which items are last in each folder level.
- Around line 64-98: The schema URL referenced in the template.json section
(both the inline markdown link near "Alle `template.json`-filer må være i
samsvar med" and the jsonschema-validator shortcode attribute schemaUrl in the
`jsonschema-validator` shortcode) returns 404; update both places to a valid
schema location or remove/disable the validator. Locate the markdown link text
and the `jsonschema-validator label="Din mal:" schemaUrl="..."` shortcode in
this file and replace the broken URL with the correct reachable raw GitHub URL
for customtemplate.schema.json (or to an alternative hosted schema) so the
validator and link work, ensuring both references are identical.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 132-134: The tree diagram continues a vertical bar after the
last-child marker; update the line after the '└── config/' entry so it does not
continue the vertical pipe. Replace the continuation indentation that includes
'│' with plain spaces so the 'applicationmetadata.json' entry is indented under
'config' (i.e., align the line containing "applicationmetadata.json" under "└──
config/" without a leading '│').

Comment thread content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Line 162: Endre teksten i linjen som inneholder "5. **Commit og push** til
hovedbranchen" ved å erstatte ordet "hovedbranchen" med det idiomatiske
bokmålsordet "hovedgrenen" slik at linjen blir "5. **Commit og push** til
hovedgrenen".
- Around line 83-91: The table under the "Felt | Type | Påkrevd | Beskrivelse"
header is misaligned and triggers MD060; fix it by ensuring each row uses the
same pipe placement and column spacing as the header row (align the vertical
bars for columns "Felt", "Type", "Påkrevd", "Beskrivelse"), adding or removing
spaces so every row has four pipe separators and matching column widths for
entries like "id", "owner", "name", "description", "remove", and
"packageReferences"; after aligning the pipes the markdownlint MD060 warning
should be resolved.
- Line 3: The frontmatter line for the guide contains a double space after the
key "description:"; remove the extra space so the line reads with a single space
after the colon (i.e., change "description:  Hvordan ..." to "description:
Hvordan ...") to normalize spacing in the frontmatter.

Comment thread content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 176-181: The table's `type` field lists `codechange` but the
examples use `code-change`, causing inconsistency; update the `type` row in the
table to either use `code-change` (preferred) or list both variants (e.g.,
`code-change` / `codechange`) to match the examples, and make the same change
for the other occurrence of the `type` values later in the document so `type`
consistently documents `configuration`, `code-change` (or both), and
`documentation`.
🧹 Nitpick comments (1)
content/altinn-studio/v8/guides/development/custom-templates/_index.en.md (1)

226-236: Fix tree indentation under config/.

After a └── marker, the vertical bar should stop; keep only spaces so the child aligns correctly.

🛠️ Proposed fix
-│   └── config/   
-│   │   └── applicationmetadata.json  
+│   └── config/   
+│       └── applicationmetadata.json  

@acn-sbuad acn-sbuad merged commit f1850bf into master Mar 17, 2026
7 checks passed
@acn-sbuad acn-sbuad deleted the docs/custom-template branch March 17, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant