Cms ContentPages Controller - Liquid Controller Reference
On this page
Description
The Cms ContentPages controller handles requests related to cms contentpages functionality in your StoreConnect storefront.
| Property | Value |
|---|---|
| Controller | ContentPagesController |
| Liquid Template Path | controllers/cms/contentpages/ |
| Namespace | Cms |
Actions
| Action | HTTP Method | Route | Liquid Page |
|---|---|---|---|
home |
GET | /cms/contentpages/home |
— |
Liquid templates
Each action runs the template below, if your theme has one.
| Action | Template |
|---|---|
home |
controllers/pages/home.liquid |
not_found |
controllers/pages/not_found.liquid |
show |
controllers/pages/show.liquid |
Liquid Controller Lifecycle
For each action, Liquid controller templates are executed in three phases:
- Before — runs before the Rails action
- After — runs after the Rails action but before the response is sent
- Final — runs after the response, useful for cleanup
Available Liquid Tags
Inside controller templates, these tags are available:
| Tag | Description |
|---|---|
{% params %} |
Set request parameters (e.g. {% params foo: "bar" %}) |
{% variables %} |
Set template variables (e.g. {% variables title: "Hello" %}) |
{% respond %} |
Respond with custom content, alert, or notice |
{% redirect %} |
Redirect the request (e.g. {% redirect to: "/products" %}) |
{% action %} |
Execute a server-side action (e.g. {% action "cart.add", product_identifier: "blue-widget", quantity: 1 %}) |
Example
Create controllers/pages/home.liquid. The before phase sets a variable before the page renders:
```liquid
{% before %} {% variables page_heading: “Welcome back” %} {% endbefore %} ```
The page template can then output it with {{ page_heading }}.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.