Feature_image link relative and absolute

Hi, I would like to understand why in some posts, the image of the post has an absolute link

<figure class = "post-full-image" style = "background-image: url (https://*****.com/content/images/2018/10/nginx-1.png)">
</figure>

In other posts, the image has a relative link

<figure class = "post-full-image" style = "background-image: url (/content/images/2018/10/nginx-1.png)">
</figure>

What is this difference due to?
This creates problems when I use the feature_image variable with Algolia

@giacomosilli In Ghost themes, you can set whether the {{img_url}} handlebars helper outputs relative or absolute urls. By default feature image URLs are relative, IIRC, but that can be overridden like so: {{img_url feature_image absolute="true"}}. What theme are you using?

1 Like

I use a very modified version of https://blog.ghost.org
This is the code I have in my posts.hbs file

    {{#if feature_image}}
    <figure class="post-full-image" style="background-image: url({{feature_image}})">
        <div class="post-full-introauthors">
            {{> components/author-accordion}}
        </div>
    </figure>
    {{/if}}

The strange thing is that in some posts, there is a relative link and in others it is absolute.

@giacomosilli I’m not sure this is related, but IIRC {{feature_image}} has been depreciated in favour of {{img_url feature_image}}. You could run your theme through gscan.ghost.org to confirm.

I’m sorry for the delay in the reply.

I did not know about this change.

However I solved by uploading the photos again to update the link for those I needed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.