Add Meta Description

Created on 26 October 2020, almost 5 years ago
Updated 24 March 2023, over 2 years ago

Problem/Motivation

As a CMS user, I'd like the ability to assign a custom meta description to the sitemap.page route, and fallback to the description that I have configured via the SiteMapSettingsForm.

Steps to reproduce

Navigate to /sitemap route and observe no meta tag exists for description.

Proposed resolution

TBD

Remaining tasks

TBD

✨ Feature request
Status

Active

Version

1.5

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States Coop920

    Any updates on this? Having the same issue. Thanks

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    Hey everyone! I'm a volunteer maintainer of this module. I think this is a great idea and would make a great addition to the sitemap module's features!

    But, I don't have any experience integrating modules with the Metatag module; and the D7 site_map issue referenced in comment #3 β†’ doesn't contain any code that I could learn from, so I don't really know what a solution to this looks like right now. Further, my employer/client doesn't need this feature, and I've been spending most of my volunteer hours on a complex D7 to D10 migration for a friend's website. Unfortunately, all of these things mean that I cannot guarantee that I will have free time to work on this feature request in the near future.

    That being said, if yourself (or someone you hire β†’ ) submits a merge request β†’ or patch β†’ to add this feature, I would be very happy to review it and merge it when it is ready!

    Alternately, I am available to hire through my company, Consensus Enterprises β†’ - hiring me to add this feature will guarantee that I have the time to work on it. If you'd like to explore this route, please contact Consensus through the contact form on our website.

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    Moving to the 8.x-2.x branch, because the 8.x-1.x branch is no longer supported.

  • πŸ‡―πŸ‡΅Japan tom konda Kanagawa, Japan

    I think custom meta description to the sitemap.page route can output as following steps.
    So no need to develop for SiteMapSettingsForm.

    1. Enable "Metatag Custom Routes" module which is a submodule of Metatag
    2. Go to /admin/config/search/metatag/custom/create
    3. Fill "/sitemap" to the Route / Path item and submit form
    4. Click edit button on /sitemap from Metatag defaults list, and edit default meta tags
    5. Save default meta tags and go to /sitemap
    6. Custom metatags are output
  • I can confirm that tricks works, but as it is not so straightforward; it is maybe a good idea to document this on a very visible location?

    Or maybe the Sitemap module can require this submodule if Metatag is detected and then automatically create the /sitemap route?

  • πŸ‡―πŸ‡΅Japan tom konda Kanagawa, Japan

    I thought LGTM, and created submodule "sitemap_metatag" as PoC.
    If this submodule is enabled, metatag settings for the sitemap page is added to metatag list.

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    I like @tom konda's approach, i.e.: with the sitemap_metatag submodule providing default configuration when installed!

    I think it would be good to add tests though. Tests ensure that future changes to the module by other contributors will not break the functionality that your site depends on.

    I think we could add tests by...

    1. Adding "drupal/metatag": "^2", to composer.json's "require-dev" section
    2. Adding a file modules/sitemap_metatag/tests/src/Functional/SitemapMetatagTest.php, which visits the sitemap and checks that the page text contains the correct values in the canonical_url metatag and title tag. You might find the documentation on Creating Functional tests β†’ helpful.

    I am happy to assist with writing tests, if you'd like!

Production build 0.71.5 2024