In the standard configuration of the contact page, it displays the content of a custom contact block in the main content region of the layout.

How could I define meta tags for this page created using the main Contact Form module:

mysite/contact

Provided that it is not a standard node.

I use two meta tag modules:

Metatag
SEO Meta Tags

In particular, I want to set an image as a meta tag and as an open graph image as well as a page meta description.

Many thanks in advance!

Comments

Hmm... that's an interesting question. I haven't used Metatags too often. I was going to suggest that you create a Layout Page and put the Contact form as a block there. I would have thought it would be possible to create metatags for layout pages, but apparently this functionality is not provided by either module.

I'll let people more experienced with metatags chime in here.

Thanks for the tip @argiepiano!

Today I had time to try this and test carefully. A solution is achieved by creating a simple (basic) contact page and setting the contact form to show only the NID or path for the contact page after the main content by setting up the relevant layout.

Then the contact page becomes a regular page, the meta tags of which can be set and managed through Metatags and SEO Meta Tags - I use both of these modules for meta tags because they complement each other well and work together as some tasks are better solved with the first one, and others - with the second.

However, the following should be considered:

The contact form module in core creates a system page with path /contact. Avoid matching the URL of the new contact page with the /contact core contact page.

I tried to fix this by setting a URL alias or redirect but all attempts ended with various error messages and at some point the regular node contact page becomes unavailable.

So I chose to leave the system path /contact without some kind of redirect to the node contact page and try to avoid the possibility of /contact path being indexed.

I think this is important for search engine optimization - both to be able to apply meta tags (for example, meta description, image, open graph tags, etc.) to the node contact page, and to avoid the possibility of simultaneously indexing the node contact page and the system contact page created by the Contact form module.

The solution that I think currently works for me is to not include path /contact in any menu which pages are included in the XML Sitemap.

In conclusion, I want to note that this way of building the contact page requires a paradigm shift and a change of habits that users accustomed to Drupal 7 have.

With Drupal 7 (as far as I know the practice I've learned learning Drupal 7) contact page uses the /contact system page and you create a custom block for contacts information (address, phones, map, etc.) that only appears on path /contact BEFORE the main content.

In the above way of working, creating a custom contact block in Backdrop is unnecessary because Backdrop allows the core contact form block to be fine-tuned and published on the regular contact page AFTER the main content through settings in the relevant layout.

In conclusion, I would suggest adding an option in the Contact form module to allow the exclusion of a /contact system page - for users who decide to implement the configuration described here.

More precisely, the Contact form should be able to create a block with the contact form, but not a page with the path /contact.

Thanks again for the advice.

Thank you very much, I will try it.

I don't currently have time to look for a solution to this problem, but I think a solution can be found (I haven't tried it yet) by displaying the contact form as a field in a specific contact content type via the Email Contact Form module.

And certainly this can be done if the contact form is built through a webform. But it would be good to find a solution for the core contact form as well because it is linked to the user's account settings and allows categories for sending messages.