Anasaki Studio

Content

Your own content types (no code)

Create content types of your own — property listings, products, portfolio items, job openings or events — with 16 kinds of fields, ready to show in the designer

5 min readLast updated

View as Markdown

On this page

Besides posts and pages, administrators can create their own content types in Settings → Content types, without writing code. For example:

SiteContent typeExample fields
Real estateProperty listingPrice (number), kind (choice), gallery, rooms (repeating rows)
Shop / catalogueProductPrice, SKU, colour (choice), in stock (yes/no)
Studio / freelancerPortfolio itemClient, year, link, gallery
CompanyJob openingDepartment, job type, salary, closing date (date)
RestaurantMenu itemPrice, group (choice), spicy (yes/no), photo

Creating a content type#

  1. Settings → Content types → New content type
  2. Set the name (Thai/English) and an icon (emoji) — an id and a site address are suggested from the English name (with a Thai name only, type the id yourself, e.g. property)
  3. Choose whether the editor has content, excerpt, cover image and categories (the title is always there)
  4. Tick Show on the site for a list page /<address> and a page per item /<address>/<slug>
  5. Add fields — name each field (its key is made from the English name, or type one), pick its kind and tick Required if it must always be filled
  6. Save — the type's menu appears in the sidebar right away

Kinds of fields#

Short text, long text, rich text, number (with a minimum/maximum), yes/no, date, date and time, choice (one per line; write house | Detached house to separate the value from its label), link, email, image, gallery, file, colour, link to other content (e.g. a product linked to its review post) and repeating rows (e.g. the rooms of a house: room name + size)

Showing them on the site#

  • Lists — place a Post list in the designer and choose your content type. Each card uses {{post.title}}, {{post.image}} and the fields as {{post.meta.<field key>}}, e.g. {{post.meta.price}}
  • The page of each item — styled with that type's post template
  • SEO — the list page and every item are in the sitemap of the SEO plugin, and the editor has the SEO panel

Fields on the site (2.5)#

  • A content type's page without a template shows the title, image, fields (price, bedrooms, event date …) and content by itself
  • The Fields block, in a template or a card of a list, shows the fields with their labels (numbers with separators, option names, images, links, dates); choose how many and a table or one line
  • A type's own archive — Settings → Display: an archive template per type
  • Filter and sort by a field — Post list → Only when, e.g. event date ≥ today (upcoming) or price ≤ query.max (from a box on the page), and Sort by field

Editing and deleting#

  • Change the name, address and fields at any time — data of fields that remain is kept (a removed field's data is no longer shown)
  • The id cannot change after creation, because content is tied to it
  • A type can be deleted once it has no content left — delete its items first

Developers can still declare content types in code (site.postType in Site Code or a plugin). When code uses the same id or address as a type made here, the code's type wins and this page shows "not used". Code reads content of a type made here with db.posts.list({ type: 'property' }).