Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Title Is Not Informative #3756

Closed
mlissner opened this issue Dec 19, 2015 · 3 comments
Closed

HTML Title Is Not Informative #3756

mlissner opened this issue Dec 19, 2015 · 3 comments

Comments

@mlissner
Copy link
Contributor

In the HTML response type, the HTML title is always the same, simply: "Django REST Framework".

As I'm working on my API, this is a minor nuisance, and I'd bet it's an easy fix to simply put the h1 value in there too, so it's:

Django REST Framework &ndash ObjectType List

I could probably take a stab at this if this was a welcome improvement.

@tomchristie
Copy link
Member

Seems reasonable, yup.

@mlissner
Copy link
Contributor Author

The title is currently made using:

<title>{% block title %}Django REST framework{% endblock %}</title>

And not a single page seems to override this block. Later in the base template, where the breadcrumbs are made, there's this:

      {% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
        {% if forloop.last %}
          <li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
        {% else %}
          <li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
        {% endif %}
      {% endfor %}

A solution that could work would be to merge these with something like:

<title>
{% block title %}
  {% for breadcrumbname, _ in breadcrumblist %}
    {% if forloop.last %}{{ breadcrumbname }} – Django REST framework{% endif %}
  {% empty %}
    Django REST framework
  {% endfor %}
{% endblock %}
</title>

That'll upgrade the title node's text to say the name of the last bread crumb in any page that has the breadcrumblist variable. In pages that don't, they'll be unaffected, returning the present value.

If this feels like a reasonable approach, I'll code it up and drop it in a PR.

Feedback requested, thanks!

@tomchristie
Copy link
Member

Do we not already have the resource title available?

tomchristie added a commit that referenced this issue Dec 23, 2015
Fixes #3756, adding the name to the HTML title, if it exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants