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

Meta tag improvements #3692

Closed
2 tasks done
joemull opened this issue Sep 13, 2023 · 3 comments · Fixed by #3714
Closed
2 tasks done

Meta tag improvements #3692

joemull opened this issue Sep 13, 2023 · 3 comments · Fixed by #3714
Assignees
Labels
enhancement Add or improve something on an existing feature

Comments

@joemull
Copy link
Member

joemull commented Sep 13, 2023

As a developer I'd like a few improvements relate to writing meta tags:

  • Django provides request.build_absolute_uri() for getting an absolute URI for any location. This is useful in templates when creating precise meta tags. So I'd like a template tag for this method, because so far as I know, we don't have another way to build these URLs in some cases. Example usage:

    <meta property="og:image" content="{% build_absolute_uri request.press.default_carousel_image.url %}">
  • Use Django's built-in truncatewords rather than our custom truncatesmart in templates/common/elements/social_meta.html

@joemull joemull added the enhancement Add or improve something on an existing feature label Sep 13, 2023
@joemull joemull self-assigned this Sep 13, 2023
@joemull joemull added this to v1.5.2 Sep 13, 2023
@ajrbyers
Copy link
Member

ajrbyers commented Sep 13, 2023

We have a template tag for building urls with the sites framework:

{% site_url 'core_reset_password' reset_token.token %} is an example.

Is this not working as expected?

@joemull
Copy link
Member Author

joemull commented Sep 13, 2023

We have a template tag for building urls with the sites framework:

{% site_url 'core_reset_password' reset_token.token %} is an example.

Is this not working as expected?

If memory serves I tried to use this but we didn't have a url_name that would work as an argument to site_url for the URL I put in the example. In other words our custom site_url is not as flexible as Django's build_absolute_uri.

@ajrbyers
Copy link
Member

Cool - its worth double checking if using build_absolute_uri will work correctly with the sites middleware. I wonder if there is a reason we haven't used it in the past. (@mauromsl ?)

@joemull joemull moved this to Todo in v1.5.2 Sep 13, 2023
@joemull joemull moved this from Todo to In Progress in v1.5.2 Sep 13, 2023
joemull added a commit that referenced this issue Sep 13, 2023
@joemull joemull moved this from In Progress to PR Submitted in v1.5.2 Sep 13, 2023
mauromsl added a commit that referenced this issue Jan 25, 2024
@github-project-automation github-project-automation bot moved this from PR Submitted to Done in v1.5.2 Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Add or improve something on an existing feature
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants