Closed SimplGy closed 8 years ago
Try this, didn't test it but should work
each article in articles
article.article.intro
img(src=env.plugins.MarkdownPage.resolveLink(article, article.metadata.thumb, env.config.baseUrl))
Wow you're fast. I did this:
img(src=article.filepath.relative.split('/').slice(0, -1).join('/') +'/'+ article.metadata.thumb)
Works, but let me try your way, looks much better.
Fantastic. I'd probably recommend others who do this guard the thumbnail path because resolveLink
doesn't like to get an undefined, but it works great:
if article.metadata.thumb
img(src=env.plugins.MarkdownPage.resolveLink(article, article.metadata.thumb, env.config.baseUrl))
I'd like to show an image thumbnail for each post on my home page. I could use an absolute path easily, but wintersmith assembles local images so nicely already I'd like to re-use that feature.
Here's what I'm trying:
Where
article.metadata.thumb
is:And the article uses that local image elsewhere so it gets put into the content tree just fine.
The missing piece is the
article.dir
-- is there a good way to get that?