Closed notakoder closed 1 year ago
Just remove the header from the Markdown contents.
I am sure I have misunderstood your comment.
If I remove the header from the markdown files, the template can no longer get the meta details such as author, date, etc... Moreover at least the Template:
header must be present there to be rendered correctly.
I presume your Markdown file currently looks like the following:
---
title: The title of my page
date: 2022-12-09
---
# The title of my page
This is the content of my page
This will result in having a duplicate title. Just remove the Markdown title:
---
title: The title of my page
date: 2022-12-09
---
This is the content of my page
I did this before but I never liked the incompleteness of the markdown file—it looked like it doesn't have a head. Beyond the aesthetic part, this also strips the semantic of the markdown—a document without an h1.
But, it seems like this is the only workaround for the requirement. Thanks anyway.
Just a quick question. Why is the code <p>Written by {{ meta.author }}</p>
in the twig template not show the white space between "by" and the author's name? It should be: Written by Jane Doe. But it shows: Written byJane Doe
This can be resolved by adding  
, but I am quite curious why a normal space does not work.
@notakoder I've also been bitten a fair amount by this space removal, especially on older themes (including my own work).
I believe at some point, Twig slightly changed the way it handled whitespace on either side of a Twig tag {{ }}
, as this didn't use to happen. I usually just get around it with an
.
I'd also be curious for a real answer on it, but I just wanted to let you know you weren't alone there. 😉
I just wanted to let you know you weren't alone there.
Good to know that. :smile: But I prefer  
instead of a non-breaking space. That seem to be exactly what I want: a normal space.
But I prefer instead of a non-breaking space.
Definitely. I wasn't trying to say
was better... its character code is just ingrained in my head from the early days of web design. 😅
:+1:
I wish to display some page information after the heading, such as—
Title of the article Author name | Date | Tags Photo Body of article
But designing this using the twig template seems impossible because the
{{ content }}
variable also includes the heading of the page. So a template with the following snippet duplicates the heading.I sure can achieve the required design using %variable_name% variables in the text file and duplicate the code with in markdown file, but this doesn't seem the most appropriate way to achieve this. Is there any variable that only takes the content of a page minus the heading (or title). If not, what is the workaround to achieve such a design?