Limited access to front matter to add image

Suppose I have an image link in the post body like ![image](https://i.postimg.cc/26fT2WHW/1.png). I have access to front matter in such a way that I can add

---
...
image: here a default value, can't change
...
---

I need to place https://i.postimg.cc/26fT2WHW/1.png where the text appeared like here a default value, can't change. But I can’t use https://i.postimg.cc/26fT2WHW/1.png directly there. Any solution, please reply.

I may misunderstand, but is this what you want to do?:

---
image: https://example.com/1.png
---

![image]({{page.image}})
  1. the : is an illegal character in that context, enclose the whole line in quotes
    image: "https://example.com/1.png"

  2. just put the path and filename in the front matter and add the https:// part in the code

@rdyar For some reason I can’t directly insert link https://i.postimg.cc/26fT2WHW/1.png in the front matter. I can Only put a default value(if available) that should be same for all posts.
@chuckhoupt, No that’s not I meant.

It sounds like you want to set a default for all posts? Jekyll has a few mechanisms for setting defaults. For example, Front Matter Defaults or Liquid’s defaults filter.

it is not real clear what your issue is, can you give more info with a real example?

when you say you can’t put the url in the front matter is that cause you get an error? or?

@rdyar I am in a situation that I have no direct access to front matter of posts. I can preset a value in front matter of posts which will unique for all posts. I can’t put image url everytime, Is there a way to grab the image url from post body and access it in front matter by using a unique value (Some times liquid - I know liquid not allowed infront matter, may have workarounds). Then I can access it in post excerpt or somewhere in the index file by using {{post.image}} tag.
@chuckhoupt You are near to that, any more suggestions

Hi, I found a workaround, but with some problem. I used following code

{% assign foundImage = 0 %}
      {% assign images = post.content | split:"<img " %}
      {% for image in images %}
        {% if image contains 'src' %}

            {% if foundImage == 0 %}
                {% assign html = image | split:"/>" | first %}
                <img {{ html }} />
                {% assign foundImage = 1 %}
            {% endif %}
        {% endif %}
      {% endfor %}

It is working here, But here post containing iframe at first position it breaks the page.

Possibly you could use the Post Excerpts feature to isolate the part of the post with the image? But maybe that isn’t enough.

If I understand correctly, you’d like to have automatic access to the the src URL of the first image in every post – sort of an image-excerpt for posts? Although you can use a work-around in Liquid, I think a custom plugin in Ruby might be a better route.

This is not possible with Vanilla Jekyll.
Jekyll does not process the body first and then the front matter. The entire document is parsed in a single pass.

Ok, thanks for the support