3

I'm working on a site with a "Research" channel that is going to have scientific names in the titles of the entries.

What's the best way to allow these names to be marked up with <em> tags so I can display them in italics?

Right now I'm using the default "Title" field Craft supplies when you set up a section, but I haven't needed to insert formatting here before.

1

I'd also suggest to enter the titles with markdown formatting. But instead of using the Craft built-in markdown filter, I'd suggest to look into the parsedown plugin provided by P+T. The plugin has an option for single line output, so you won't end up with your title wrapped in <p> tags.

<h1>{{ entry.title|parsedown('line') }}</h1>
  • Markdown (and parsedown) are good suggestions. The downside is that I've trained my client to use redactor toolbars for formatting and this would be the only place where they would need to use markdown. I also can't add instructions to the "Title" field to remind users that they can use * to get the italics. I may have to go with this though if there isn't a cleaner way to do it. – Adam Snetman Sep 5 '14 at 0:12
2

I would have the user enter the title with markdown formatting: So they would enter "Title with *italics*" in the title field, and in the template you would display it with: {{entry.title|md}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.