Home > Back-end >  How to remove Image location showing in body although it is in a Meta Tag
How to remove Image location showing in body although it is in a Meta Tag

Time:10-31

I have a Django project and I added an Image meta tag as following in the base.html

    <meta property="og:image" content="{% block image %}{% endblock %}">
    <meta property="og:image:type" content="image/jpeg">
    <meta property="og:image:width" content="300">
    <meta property="og:image:height" content="300">

in the home.html page I have added the following:

{% extends 'base/base.html' %} {% load static %}
{% block content %}
{% block description %}{{ info.description }}{% endblock %}
{% block image %}{{ info.avatar.url }}{% endblock %}

My issue is that in the home page in the top the location of the image is showing as per below: enter image description here

I am not sure why the image link is showing and I am not sure how to remove it.

My question is how to remove the location of the file from the page.

CodePudding user response:

This location come from this tag {{ info.avatar.url }}, just remove it and url in home page will disappear, if you want to show the image itself instead, you can replace it with img tag like this:

CodePudding user response:

Use CSS to hide the url on your page like below :-

{% extends 'base/base.html' %} {% load static %}
{% block content %}
{% block description %}{{ info.description }}{% endblock %}

<span style="display:none;">
    {% block image %}{{ info.avatar.url }}{% endblock %}
</span>
  • Related