bolt-cms

How to get contenttype options in Bolt CMS


I have contenttype for products:

products_de:
    name: Products (de)
    singular_name: Product (de)
    slug: produkte
    singular_slug: produkt
    tablename: products_de
    fields:
        ...

I've set slug for german site version links. But how I can get contenttype slug from my template? I need it automaticly, because I want to add contenttype products_en with slug products for english site version.

For example, in listing template I can do

{% setcontent products = 'products_de' %}

But its get me contenttype records but not contenttype options. There is 'contenttype' key in array record, but there is may not be any products, so I'll can't get it.

Is there any global methot to get contenttype options, something like config:

{{ config.get('general/sitename') }}

UPD: I am interested in the same for taxonomies - how to get taxonomy options such as name, slug?


Solution

  • I found a solution. Contenttype data can be obtained with:

    {{ config.get('contenttypes/pages') }}
    

    Taxonomy data can be obtained with:

    {{ config.get('taxonomy/categories') }}
    

    So you can do just:

    {% set products_data = config.get('contenttypes/products_de') %}
    {{ products_data.name }}
    {{ products_data.slug }}