question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there way to use frontmatter variable as image path?

See original GitHub issue

Like this:

---
title: Hello World
picture: /news/1.jpg
---

# {{ title }}

![image](picture)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
yankeeinlondoncommented, May 24, 2022

dropped a PR today that enables this feature … not on npm yet but should be soon

1reaction
yankeeinlondoncommented, Apr 23, 2022

I have added this into a PR i’m working on and all tests are now passing for links, images, and others:

  payload.html = select(payload.html)
    .updateAll('img')(update('src'))
    .updateAll('iframe')(update('src'))
    .updateAll('srcset')(update('src'))
    .updateAll('a')(update('href'))
    .updateAll('link')(update('href'))
    .updateAll('prefetch')(update('href'))
    .toContainer()

  return payload

Give me a few days to push this PR out … it’s a pretty big one but it’s other features are largely just exposed as a “builder API” should have no impact on normal usage.

Read more comments on GitHub >

github_iconTop Results From Across the Web

declare image path in front matter as variable using {{ site.url ...
When I use the {{ site.url }} tag for an image path inside a variable in the front matter, it doesn't get translated...
Read more >
Is there a way to update an image based on a YAML variable in the ...
I'm starting to use Obsidian for gaming, and it's near perfect with DataView ... I've got the absolute path in the variable imagepath...
Read more >
Using variables or functions in page front matter - support - HUGO
I can see very little clear advice on how to use variables or functions. There are some syntax inconsistencies in how these are...
Read more >
Guide for different ways to access your image resources
The way you can solve this in Hugo is using front matter and adding a new variable resources to your YAML part. Information...
Read more >
Static Files | Jekyll • Simple, blog-aware, static sites
A static file is a file that does not contain any front matter. These include images, PDFs, and other un-rendered content.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found