Links and navigation
Use these filters to encode URL values and create links that respect the current service and journey context. Prefer the accessible Govforms variants where available, and never expose review tokens or generated private URLs in logs or public content.
Standard Liquid filters
These filters are provided as standard by the Liquid language. They are available anywhere Govforms accepts a Liquid template.
| Filter | What it does | Example |
|---|---|---|
cgi_escape() | Escapes text for a CGI query string Percent-encodes special characters and replaces spaces with plus signs. | {{ "hello world!" | cgi_escape }} → hello+world%21 |
slugify(mode, preserve_case) | Converts text to a URL-friendly slug Replaces unsupported characters with hyphens. The optional mode controls allowed characters. | {{ "Hello World" | slugify }} → hello-world |
uri_escape() | Escapes unsafe characters in a URI Encodes unsafe characters while preserving URI separators such as slashes. | {{ "https://example.com/a path" | uri_escape }} → https://example.com/a%20path |
url_decode() | URL decodes string Decodes URL-encoded characters. | {{ "hello%20world" | url_decode }} → hello world |
url_encode() | URL encodes string Encodes special characters for URLs. | {{ "hello world" | url_encode }} → hello%20world |
Govforms filters
These filters are added by Govforms for service-building and data-handling tasks.
| Filter | What it does | Example |
|---|---|---|
completed_answers_link(link_text) | Creates link to completed answers page Generates HTML link to view submitted form answers. | {{ "View Answers" | completed_answers_link }} |
external_service_link(link_text, url, classes, ...params) | Creates external service link with parameters Generates link to external URL with query parameters. | {{ "External Link" | external_service_link: "https://example.com", "btn", "param1", "value1" }} |
external_service_link_accessible(link_text, visually_hidden_prefix, visually_hidden_suffix, url, classes, ...params) | Creates accessible external service link Like external_service_link but with screen reader text. | {{ "Link" | external_service_link_accessible: "Go to", "page", "https://example.com", "btn" }} |
file_download_link(field_id, link_text) | Creates file download link Generates download link for uploaded file in specified field. | {{ "upload_field" | file_download_link: "Download File" }} |
file_view_link(field_id, link_text) | Creates file view link Generates view link for uploaded file in specified field. | {{ "upload_field" | file_view_link: "View File" }} |
get_query_param(url, param) | Gets the value of query parameter within the given URL Returns the query parameter value if present | {{ "https://test.com?a=1&b=2 | get_query_param: "b" }} |
html_view_link(html_data_path_or_expression, link_text) | Creates HTML view link Generates a link to view HTML data returned by an action or expression. | {{ actions.fetchHtml.compressedHtml | html_view_link: "View HTML" }} |
page_link(link_text, page_id, classes, ...params) | Creates form page navigation link Generates button to navigate to specific form page without validation. | {{ "Go to Page 2" | page_link: "page2", "btn" }} |
page_link_accessible(link_text, visually_hidden_prefix, visually_hidden_suffix, page_id, classes, ...params) | Creates accessible form page link Like page_link but with screen reader text. | {{ "Continue" | page_link_accessible: "Go to", "next page", "page2", "btn" }} |
page_submit_action(link_text, classes, ...params) | Creates form submit action without navigation Generates button to submit form data without changing pages. | {{ "Save" | page_submit_action: "btn-secondary" }} |
page_submit_action_accessible(link_text, visually_hidden_prefix, visually_hidden_suffix, classes, ...params) | Creates accessible form submit action Like page_submit_action but with screen reader text. | {{ "Save" | page_submit_action_accessible: "Save", "progress", "btn" }} |
page_submit_link(link_text, page_id, classes, ...params) | Creates form page submit link with validation Generates button to navigate to page with form validation. | {{ "Continue" | page_submit_link: "page2", "btn" }} |
page_submit_link_accessible(link_text, visually_hidden_prefix, visually_hidden_suffix, page_id, classes, ...params) | Creates accessible form page submit link Like page_submit_link but with screen reader text. | {{ "Submit" | page_submit_link_accessible: "Submit", "form", "page2", "btn" }} |
page_url(page_id, ...params) | Gets full URL for form page Returns complete URL for specified form page with parameters. | {{ "page2" | page_url: "param1", "value1" }} |
pdf_download_link(action_id, link_text) | Creates PDF download link Generates HTML link to download PDF with specified action ID. | {{ "report1" | pdf_download_link: "Download PDF" }} |
pdf_view_link(action_id, link_text) | Creates PDF view link Generates HTML link to view PDF in browser. | {{ "report1" | pdf_view_link: "View PDF" }} |
print_link(link_text) | Creates print page link Generates HTML link that triggers browser print dialog. | {{ "Print Page" | print_link }} |
reset_password_link(link_text) | Creates link for signed-in user to change password Generates HTML link to password change page. Only works for services using Cognito authentication. | {{ "Change your password" | reset_password_link }} |
restart_link(link_text) | Creates form restart link Generates HTML link to restart the current form. | {{ "Start Over" | restart_link }} |
review_token(action_id) | Gets review access token for action Returns access token for reviewing specific action or default token. | {{ "action1" | review_token }} |
service_link(link_text, service_id, org, classes, ...params) | Creates internal service link Generates link to another service within the platform. | {{ "Other Service" | service_link: "service123", "myorg", "btn" }} |
service_link_accessible(link_text, visually_hidden_prefix, visually_hidden_suffix, service_id, org, classes, ...params) | Creates accessible internal service link Like service_link but with screen reader text. | {{ "Link" | service_link_accessible: "Go to", "service", "service123", "myorg", "btn" }} |
service_url(service_id, org, ...params) | Gets URL for internal service Returns just the URL for another service (no HTML link). | {{ "service123" | service_url: "myorg" }} |
