Skip to content

Missing space before conditional attribute in opengraph.html #36

@Storagezilla

Description

@Storagezilla

I'm back, (apologies). I couldn't get micro.blog to generate a test OpenGraph card while editing a template. It looks to be choking on the lack of a space.

File: layouts/opengraph.html
Description
There's a missing space before the {{ if }} block on line 1, which causes two HTML attributes to be concatenated without a separator when custom_avatar is set.

Current code:
htmldata-content-background="#3d4149"{{ if .Site.Params.custom_avatar }} data-avatar-url="{{ .Site.Params.custom_avatar }}"{{ end }}>

When custom_avatar is set, this renders as:
htmldata-content-background="#3d4149"data-avatar-url="https://example.com/avatar.jpg">
Two attributes with no space between them seems to make micro.blog choke on rendering this as an OpenGraph card.

Fix
Add a space before the conditional, it then worked when I tried it:
htmldata-content-background="#3d4149" {{ if .Site.Params.custom_avatar }} data-avatar-url="{{ .Site.Params.custom_avatar }}"{{ end }}>

Thanks!

Mark.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions