Set the home page
The home page is what visitors see when they open your bare domain, such as https://example.com/. In Raytha 2.0 a site page, a content item or a list view can be the home page. In the admin you set a site page; the other two need the API.
What you need
- The Manage Site Pages permission.
- A site page that is published. Raytha refuses an unpublished page: "You cannot set an unpublished page as the home page. Publish the page first and then try again."
Set a site page as the home page
- Click Site pages in the sidebar.
- Click the page you want, for example Landing. If it is a draft, click Publish first.
- In the page header, click Set as home page.
- Confirm. The dialog says "Visitors to the site root will see this page."
You should see a Home badge next to the page's title in the Site pages list. Open your site's root address to check.
A new installation already has a site page named Home set as the home page. To replace it, set another page as above. The old page stays; it is just no longer the home page.
Rules that apply to the home page
- You cannot unpublish the home page. Choose a different home page first.
- You cannot delete the home page, whatever its type. Choose a different one first.
- You cannot delete a content type while one of its items or views is the home page.
In the admin, a home page content item shows a house icon labelled Home page next to its title in lists, and a home page view shows a Home page badge in its heading.
Use a content item or a view as the home page
The admin does not have a button for these two. The REST API does. You need an API key (see Create an API key for the Headless REST API) sent in the X-API-KEY header.
Make a published content item the home page (the key needs edit permission on that content type):
curl -X PUT \
-H "X-API-KEY: $RAYTHA_API_KEY" \
"$RAYTHA_URL/raytha/api/v1/contentitems/posts/CONTENT_ITEM_ID/set-as-home-page"
Make a published view the home page (the key needs permission to configure that content type):
curl -X POST \
-H "X-API-KEY: $RAYTHA_API_KEY" \
"$RAYTHA_URL/raytha/api/v1/contenttypes/posts/views/VIEW_ID/set-as-home-page"
Replace posts with the content type's developer name, and the ids with the item's or view's id. Both calls fail unless the item or view is published.
Which should I choose?
| Type | Choose it when |
|---|---|
| Site page | You want a designed landing page that you edit visually. This is the right choice for almost every site. |
| Content item | Your home page is one entry of a content type and you want its fields to drive the page. |
| View | The home page should simply be a list, such as your latest posts. |
Gotchas
- Menu links do not change. Raytha does not rewrite them. The seeded Main menu links Home to
/home, the route path of the original Home page. Update menu items if they should point at/. - Draft edits are not shown. The home page shows published content. Publish to update it.