=====
Pages
=====
Pages are the primary unit in glass, and there are some special-purpose pages,
and ways to make pages have extra capabilities, like having children pages or automatic redirects.
Standard Pages
--------------
All pages have a template associated. The template defines which content areas go on the page.
Parents with Children
---------------------
Pages can have a `parent` which creates an internal nesting structure. This is *totally unaffiliated* with the navigation app.
This internal nesting structure can be queried in the templates and API.
The most simple way to get all children of a current page is this tag.::
{% children %}
This puts them in the template with the variable name `children` and you could view them like this::
{% for child in children %}
Path: {{ child.path }}
{% endfor %}
Here's an example of paginating all the children of the page with path `blog/`::
{% children parent="blog/" as posts %}
{% autopaginate posts 10 %}
{% for p in posts %}
{{ p.content.title }}
{{ p.content.main|truncatewords_html:75 }}
{% endfor %}
{% paginate %}
Here's an example that gets four random children::
{% children parent="products/" as random_products order_by="?" limit=4 %}
You can use the `order_by` field to sort the children
* published
* last_published
* modified
* created
* path
* Use "-" before any of the above to order in reverse. "-created" is newest first. The default is "-published"
* `?` for random ordering.
Example Using Children to make a Blog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XML/RSS/Atom processing
#######################
Programmed Pages via AWS Lambda
-------------------------------
It's possible to use AWS Lambda to return or render a URL on your site. If you think you need this functionality, email Issac.
Search
------
Redirects
---------
404 & 500 Errors
----------------
If you have a template named 404.html or 500.html, that will be used in the event of a site error.
If you don't, we'll use our standard page.
You can test your 404 and 500 error pages at /siteapi/500 and /siteapi/404