SEO and Django with title and description tags

0 votes
I have a base.html for the base template for my files. I have a tag inside it where I define both title & description tags.
I also have my home page that is home.html and it doesn't need a specific title or description a general one is enough .
I also have detail.html used for blog posts and I try to improve the seo with this

 :<meta name="description"
 content="{{ blog.formatted_summary|striptags }}">

<title>{{ blog.title|safe }}</title>

I am  defining both title and description twice and I can't think why that would be a good idea. How do I insert the title and description into the base.html so if it is a blog post that I can specify to take the body or the summary as a description without defining the properties again?
Mar 8, 2022 in Digital Marketing by Kichu
• 19,040 points
693 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
The best solution for this is to configure base.html template to search for custom header data in the template that leverage base.html

for an example you can add this in your base.html

<title>{% block title %}{% endblock %}</title>

Then, in your home.html file,

{% block title %}Homepage Title{% endblock %}

And in detail pages you can dynamically update titles with something like this:

{% block title %}Organization Name - {{ object.some_varyable_from_query }}{% endblock %}
answered Mar 10, 2022 by narikkadan
• 63,600 points

edited Mar 5

Related Questions In Digital Marketing

0 votes
0 answers

Does hiding site title and/or tagline or site description matter SEO?

In so many tutorials and videos I ...READ MORE

Mar 8, 2022 in Digital Marketing by Kichu
• 19,040 points
491 views
0 votes
0 answers

Replace tags with space in PHP for SEO Meta Description

I am trying to strip tags from ...READ MORE

Mar 12, 2022 in Digital Marketing by Kichu
• 19,040 points
671 views
0 votes
0 answers

Replace tags with space in PHP for SEO Meta Description

I am trying to strip tags from ...READ MORE

Mar 13, 2022 in Digital Marketing by Kichu
• 19,040 points
731 views
0 votes
1 answer

Yoast SEO: remove og:description and twitter:description

add_filter("wpseo_opengraph_desc", "remove_yoast_og"); add_filter("wpseo_twitter_description", "remove_yoast_og"); function remove_yoast_og($description) { ...READ MORE

answered Mar 1, 2022 in Digital Marketing by narikkadan
• 63,600 points
852 views
0 votes
0 answers

Angular 2 and SEO meta tags

i need to add met tags to ...READ MORE

Mar 6, 2022 in Digital Marketing by Kichu
• 19,040 points
526 views
0 votes
0 answers

How does writing heading (h1, h2, h3) tags helps with SEO?

I have heard that using h1 h2 ...READ MORE

Mar 8, 2022 in Digital Marketing by Kichu
• 19,040 points
581 views
0 votes
1 answer

how to download and install Django rest framework?

To install Django, you can simply open ...READ MORE

answered Apr 24, 2018 in Python by Christine
• 15,790 points
2,157 views
0 votes
1 answer
0 votes
1 answer

Host not allowed

Go to your project directory cd project cd project ALLOWED_HOSTS ...READ MORE

answered Aug 9, 2018 in AWS by Priyaj
• 58,020 points
1,889 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP