-
-
Notifications
You must be signed in to change notification settings - Fork 558
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
Truncate titles and descriptions when they exceed limits #559
base: main
Are you sure you want to change the base?
Conversation
@@ -1,13 +1,13 @@ | |||
{% extends "base.html" %} | |||
{% load static %} | |||
|
|||
{% block headtitle %}{{media_object.title}} - {{PORTAL_NAME}}{% endblock headtitle %} | |||
{% block headtitle %}{{media_object.title|add:" - "|add:PORTAL_NAME|truncatechars:64}}{% endblock headtitle %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
{{media_object.title|truncatechars:5}} - {{PORTAL_NAME}}
is what you want here, if you want to truncate the title and keep the portal name at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I figured it was more important to have the media title in there than to always have the portal name in there, which is why I truncated the concatenation instead.
This is unrelated with the scope of this PR, however if you have the capacity to add it it would be great to wrap the description below the media (with a show more option) - since now it will display the whole description |
Fair enough. I'll see what I can do. |
I split this off into its own issue (#660) so I can remember to work on it. |
Description
Users on an instance I'm running like to use really long titles and descriptions. Per:
https://www.w3.org/Provider/Style/TITLE.html#:~:text=The%20title%20should%20ideally%20be,there%20is%20only%20limited%20room.
...titles should only be 64 characters long, and meta descriptions should usually be limited to 160 characters. This change truncates both if they exceed limits to keep things in compliance.
Steps
Pre-deploy
Post-deploy