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

If Google isn’t indexing content revealed through user interactions like hover or click, it could negatively affect your SEO.

To address this and ensure Google indexes your accordion content, follow these steps to make it accessible to search engines and crawlers:

  1. For the collapsed variant, set the height of the “Answer” layer to 0 and its opacity to 0. This makes the content visible to the browser but hidden from users.

  2. For the expanded variant (when the content is visible to users), set the height to “Fit content” and the opacity to 1.

For a practical example and detailed guidance, you can remix the project here.