Allow setting metadata with anvil.server.FormResponse

Really great feature! anvil.server.FormResponse is a total game-changer! I can finally stop using my hacky workaround (which had downsides like slower responses and cookies not working).

However, just one limitation right now - I can’t change the metadata information like my title, description, or image when returning the form response. So for example, if I get a request to example.com/form1, I will want to return the specific title and description (or image if required) for form1.

5 Likes

This would be a wonderful feature to add.

2 Likes

I really appreciate the current development efforts in the area of creating greater visibility for the indexing of subpages, and offering a way to serve pages based on sub page specific URLs. But…I think we need to be able to add meta tags for such sub pages as well. I also think this is a more general request than adding metadata only to pages served with anvil.server.FormResponse.

This idea of adding the meta tags seems to be a common request across various platforms, e.g., in Wordpress applications. https://blog.hubspot.com/website/add-meta-tags-to-wordpress

For example, some wordpress plug-ins provide this functionality, such as Yoast SEO. https://www.bluehost.com/blog/yoast-seo-wordpress-seo-plugin/

In some low or no code environments like Drupal, there has been some effort to do so, but Drupal of course has the difficulty of rebuilding their code base frequently, so their most focused meta tag module seems to be poorly supported. https://www.drupal.org/project/metatag/issues/2665182

Similarly, in Django (once a fork from Drupal, I believe) there’s effort along the same lines. Wagtail SEO Guide | AccordBox

This not a criticism of anything now available in Anvil. I offer this only to share some alternative approaches that are out there.

By default, Anvil already allows you to set default metadata like Title, Description, Image, Favicon. You can always include other meta tags in your Native Library.

1 Like

Thanks, but isn’t that only going to address the entire app as determined by the start page? I’m not sure what you mean by Native Library and how that would solve the issue of meta tags specific to particular “pages” that and external indexer would see or try to route others to. I appreciate your earlier suggestion for how one could do a workaround, and that strikes me as a great start.

Yes, this is why this feature request exists.

The thing is, routes are a very new feature and Anvil have confirmed already that this is just the start and a lot of additional improvements are coming.

My reply was for this line only.

1 Like

Thank you. I have faith in Anvil and the team. I’m proceeding with my development all within Anvil.

2 Likes