Add defaulttext
property to default data
object available to page layouts.
#269
Labels
text
property to default data
object available to page layouts.
#269
Add default
text
property to defaultdata
object available to page layoutsBackground;
I was modifying my blog ; blog.alanhemmings.com that uses Nuejs, and I was fixing some rough edges that was stopping Linkedin previews from working when pasting a blog url.
In order to pass the linkedin post checker "checks" (https://www.linkedin.com/post-inspector/) I needed to make a few changes to my
/posts/layout.html
template to support the required meta tags that Linkedin looks for.I was cheating and using the title as the title as well as the description ` but Linkedin gave me a warning saying that the description needs to be a minimum of 100 characters
At first I tried
content="{ text.substring(0,100) }"
and that didnt work. I triedcontent="{ content.textContent.substring(0,100) }"
thinking that content was perhaps a dom element. I also tried parsing the content as Dom and then reading textContent but that didnt work either.I also tried reading the nuekit src, focusing on the code for
pushMeta
but couldn't see any way to access the textContent property of content.
In the end I just added
summary
field to the markdownfront matter
, and usedcontent="{ summary }"
and manually added in a 100 character summary.However, that's extra hoops I have to jump through and can easily result in the summary not matching the actual content.
More importantly it interferes with the flow of writing content having to worry about and remember that when i'm writing for Linkedin I need another
front matter
variable, when other times I do not. That feels like programming and not writing! So breaks the "flow" of writing. (it also feels like this breaks the separations of concerns that Nuejs praises as a core value, essentially repeatingfront matter
configuration data because of how the page will be consumed.)What I'd prefer to have is access to the text property of the content as a field called
text
and then simply do this;That will allow me to override it automatically picking the first 100 text characters by providing a summary in my
front matter
.{summary}
metadata to blog post (front matter
)Note: there are more tags that are required for Linked in addition to the
{summary}
, I'll write a short blog post on what was finally needed. The point is that I was able to update mylayout.html
to handle everything automatically except for the summary, hence this new issue request.The text was updated successfully, but these errors were encountered: