Content types are like models. Let's say you want to display and manage events on your site, each event having a title, a description and a date.
## 1. Declare the "events" content type
## 2. List events on a page
Content type entries can be accessed with `
contents.<<content_type slug>>`. Open **app/views/index.liquid** and add in the 'main' block:
Test your code [http://0.0.0.0:3333](🔗). You should see the event list.
## 3. Add an "event page"
You want to display details about each event on a seperate page. Url will be **/events/<<event slug>>**. We will use an event template page.
Use your own code Editor
You could replace **vi** by your preferred code editor (SublimeText, TextMate, ...etc).
Note that the page filename should be **content_type_template**.
Add this code (we assume your index page contains a 'main' block):
OK, now let's change the index page to add a link on each event entry:
If you want the editors to have a link to the list of events when they edit the index page, you need to wrap your code with the **editable_model** liquid tag like this way:
So, when your editors edit the index page, they will see a shortlink to the list of events.