NAME
Developer::Dashboard::Guide::Pages - creating and working with saved pages
DESCRIPTION
Creating, saving and working with saved pages and the actions that attach to them.
This guide is part of the Developer::Dashboard manual. The main page is the front door for the whole set.

A new page is written with page new, stored with page save, and then shows in page list.
Working With Pages
Create a starter page document:
d2 page new sample "Sample Page"
Save a page:
d2 page new sample "Sample Page" | d2 page save sample
List saved pages:
d2 page list
Render a saved page:
d2 page render sample
d2 page render now uses the same page-runtime preparation path as the browser route, so saved bookmark TT such as [% title %] and [% stash.foo %] is rendered there too instead of only working under /app/<id>.
Encode and decode transient pages:
d2 page show sample | d2 page encode
d2 page show sample | d2 page encode | d2 page decode
Run a page action:
d2 action run system-status paths
Bookmark documents use the original separator-line format with directive headers such as TITLE:, STASH:, HEAD:, HTML:, and CODE1:. HEAD: accepts trusted raw HTML and inserts it inside the rendered document's <head> element; do not place untrusted or user-supplied text there.
Posting a bookmark document with BOOKMARK: some-id back through the root editor now saves it to the bookmark store so /app/some-id resolves it immediately.
The browser editor now loads one visible block per bookmark section while it keeps the canonical separator-based bookmark source in a hidden form field for saves and play requests. Each visible block still uses the syntax-highlighted overlay viewport that follows the real textarea scroll position by transform instead of a second scrollbox, so long lines, full-text selection, and caret placement stay aligned with the real editor.
Pressing Tab inside one block starts the next section block, and the browser recomposes those blocks back into the original separator-line bookmark document before it posts or plays the page. The directive assist still understands :--- when you paste older single-textarea workflows into one block, expanding it to the full separator line and seeding the next sensible directive.
Edit and source views preserve raw Template Toolkit placeholders inside HTML: sections, so values such as [% title %] are kept in the bookmark source instead of being rewritten to rendered HTML after a browser save. Template Toolkit rendering exposes the page title as title, so a bookmark with TITLE: Sample Dashboard can reference it directly inside HTML: with [% title %].
Transient play and view-source links are also encoded from the raw bookmark instruction text when it is available, so [% stash.foo %] stays in source views instead of being baked into the rendered scalar value after a render pass.
Earlier CODE* blocks now run before Template Toolkit rendering during prepare_page, so a block such as CODE1: { a = 1 }> can feed [% stash.a %] in the page body. Returned hash and array values are also dumped into the runtime output area, so CODE1: { a = 1 }> both populates stash and shows the bookmark-style dumped value below the rendered page body.
The hide helper no longer discards already-printed STDOUT, so CODE2: hide print $a keeps the printed value while suppressing the Perl return value from affecting later merge logic.
Page TITLE: values only populate the HTML <title> element. If a bookmark should show its title in the page body, add it explicitly inside HTML:, for example with [% title %].
/apps redirects to /app/index, and /app/<name> can load either a saved bookmark document, a saved ajax/url bookmark file, or an installed skill index page when the smart route resolves to a skill.
Saved URL bookmark compatibility is preserved. A saved bookmark whose raw content is an HTTP(S) URL returns a 302 redirect to that URL and appends the current query string. A local route is forwarded inside the dashboard instead; bookmark parameters are merged with request parameters, and array parameters are reduced using <name>.selected.pos before forwarding.
Template Toolkit includes are skill-aware. A skill bookmark can use [% INCLUDE "fragment.tt" %] for a file beside its dashboard, or [% INCLUDE "skills/foobar/dashboards/fragment.tt" %] for an explicit runtime skill path. Normal dashboard bookmarks continue to resolve includes from their layered dashboards roots.
The Ajax helper renders supplied code as a Template Toolkit template before either transient URL encoding or saved-file storage when data => \{ ... \} is provided. For example, Ajax( code => 'print [% args %];', data => \{ args => 123 \}, ... ) encodes or stores print 123; for the Ajax worker to execute.