How does one work with themes?

I’ve read a lot in the documentation, but I really don’t get how certain things from a theme are supposed to be referenced, when you write a text in markdown, where exactly it goes. I’ve been trying to figure out exactly what I should be doing so I can properly use a different theme and write my content in the right place, but it just seems rather complicated.

Hello,

The content of your markdown file will go in the block :

{% block content %},{% endblock %}
--- 
Of the corresponding `twig` file.

I'll give you an example of my own, 
I have a modular page `modular.html.twig`

{% extends ‘partials/base.html.twig’ %}
{% block content %}
{{ page.content }}
{% for module in page.collection() %}
{{ module.content }}
{% endfor %}
{% endblock %}

As you can see, the contant of a page `modular.md` will go in the `{% block content %},{% endblock %}`

My `modular.md` looks like that :

title: 'Page modulaire’
menu: 'Contenu’
onpage_menu: true
content:
items: '@self.modular
order:
by: default
dir: asc
custom:
- _texte
- _texte2

It will call two sub-modular in subfolder `_texte` and `_texte2`
In those subfolder I have a markdown file `texte.md`

article:

  • titre: h1 de l’article
    titre2: h2 de l’article
    position: droite
    photo:
  • image: section-01.jpg
    legende: Balise alt de l’image

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel cupiditate, laudantium ipsum nesciunt! Enim exercitationem epellendus accusantium minus obcaecati nisi, consectetur temporibus modi et aliquam. Dicta sunt beatae, illum sit!

The corresponding twig file texte.html.twig looks like that :

<section class="row contenu">
	{% for art in page.header.article %}
		{% if art.position|lower|contains('droite') or art.position|lower|contains('right') %}
			<article class="col-xs-12 col-sm-6 right">
		{% else %}
			<article class="col-xs-12 col-sm-6">
		{% endif %}
				<h1 class="titre1">{{ art.titre }}</h1>
				{% if art.titre2 %}
					<h2 class="titre2 color2">{{ art.titre2 }}</h2>
				{% endif %}
				{{ page.content }}
			</article>
		{% endfor %}
		{% for img in page.header.photo %}
			<figure class="col-xs-12 col-sm-6">
				<img src="{{page.media[img.image].url}}" alt="{{ img.legende }}" />
			</figure>
	{% endfor %}
</section>

In this template you can see {{ page.content }}, this is where the content of the texte.md will go.

I’m not a specialist in templating, but I hope that it will help :wink: