artistro08/tailor-starter

add capacity to add blocks/items

Closed this issue · 2 comments

Suggestion to ease the process to add our own blocks/items.

in the page htm, there is this code handling the builder type:

{% if page.entry_type == 'builder' %}
            {% for section in page.builder %}
                {% partial 'builder/items' section=section %}
            {% endfor %}
        {% endif %}

it would be great to have an already prepared empty custom_items partial and have:

{% if page.entry_type == 'builder' %}
            {% for section in page.builder %}
                {% partial 'builder/items' section=section %}
                {% partial 'builder/cusotm_items' section=section %}
            {% endfor %}
        {% endif %}

so we arrange our custom blocks/items with overriding the custom_items partial instead of overriding the items partials which might change in the future when you add yourself some other blocks. Like this, it will not disrupts existing customized theme.

just an idea as I am facing the issue right now as I am creating a builder block type called timetable

I actually just improved this with the restructure of the theme.

The idea behind this is to not touch the layout files and include your own builder items in the builder\items.htm partial.

However, this does not reflect the documentation of the theme (which is in the works). The steps to create your own blocks would be as follows:

  • Create your own mixin for the builder item under content\mixins\builder (preferably in a folder to keep things organized)
  • link to your builder items by creating an entry under the groups section in the content\mixins\builder\builder.yaml file
  • add your partials in the builder partial folder
  • link to them in the builder\items.htm file

The reason why I chose not to include a custom_items builder item is that I haven't figured out a way to make this dynamic. There should be a item for each builder item that is clearly named for easy file management. That's my philosophy anyway.

If you have an idea to make this part of the theme dynamic that isn't adding generic items, I'd love some options.

While it isn't an automatically generated setup, I created documentation on how to add your own custom blocks to the theme.

You can view that below

https://artistro08.gitbook.io/tailor-starter-documentation/pages/blocks/creating-blocks