.Render.Content vs .Content messes up markdown table

I’m modifying my docs/single.html layout (using Docsy theme) to include something like a byline. I would prefer the byline to go under the .Title, so I use this…

{{ define "main" }}
	<h1>{{ .Title }}</h1>
	<left><p><font color="#00437b"><b>Author:</b> {{ .Params.author }} | <b>Version:</b> {{ .Params.version }} | 
		<b>Created on:</b> {{ .Params.date | time.Format ":date_short" }} | 
		<b>Last Modified:</b> {{ .Params.lastmod | time.Format ":date_short" }} | 
		<b>ServiceNow PRJ#:</b> {{ .Params.servicenowprj }}</p></font></p></left>
	{{ .Content }}
{{ end }}

But when I use that, the markdown formatting of a table in my content docs disappears (where it would have shown alternating grey lines in the table.

So instead of using {{ .Content }}, I’m having to use {{ .Render “content” }}. This gives me my table formatting, but now it lumps the .Title into the content, which means I have to put my byline either above the title or below the content.

How can I fix this where the .Title can come first, then the byline, then the content (without reprinting the title) while keeping my table format?

Is it rendered as a table, or is the table not styled as expected?

You need to look at the content.html template in the theme and figure out the CSS class used for the content wrapper and then use that to surround your .Content (add a div).

It still looks like a table without the style.

Yep, that seemed to do the trick. Thanks!

<div class="td-content">{{ .Content }}</div>
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.