It says:
«If you want to include a link to a post on your site, the post_url tag will generate the correct permalink URL for the post you specify. {% post_url 2010-07-21-name-of-post %} »
Does that help in your case?
Best, Michael
Hey @michaelbach
Thanks for coming forward to help
But how can i fetch the contents of that post ?
The tag filter just outputs a string that carries the post url, but I would need the contents of that particular post referenced through the url just something like
I don’t think you can do it as you are basically asking it to loop thru all posts and find this particular one, which is a loop.
Is this just one specific post? or multiple times you want to do something similar? if it is just one then maybe the include is a good idea. Maybe even put the loop in the include and that would only run once maybe? you could pass in the frontmattervariable to the include.
post 1 - Front matter
model: “05”
warranty: “five years”
post 2 - Front matter
mode: “06”
warranty: “six years”
Help me design a constructor that fetchs the post 2 through mode == “06”
And hence print the warranty period of the particular model…
Preferably through your afore mentioned method.(i.e) using where_exp:
And it works as expected
But the thing is it works only for variable title: and any other custom front matter variable fails to return output (shows no error though)
Should i be adding something to initialize the front matter variable in config.yml ?
Yes indeed. Great… so now you know what the problem is. Can you try some extra/better escaping of the numbers? Or can you try to enforce ‘string’ treatment by adding a letter in front of the number?