Why isn't my website's accordion content getting indexed?

If Google is not indexing content that is revealed through user interactions, such as hover or click, this can impact your SEO.

If you suspect this is happening on your website, follow these steps to ensure Google indexes your accordion content, making it visible to search engines and crawlers for SEO purposes.

  1. In the collapsed variant, set the content's height to 0 and its opacity to 0 for the "Answer" layer. This ensures the content is visible to the browser but not to users.

  2. In the variant where content should be visible to users, set the height to "Fit content" and the opacity to 1.

For a hands-on example and to see how to set up this project, you can remix it here.