Altinn / altinn-studio-docs

Documentation for Altinn 3
https://docs.altinn.studio
Apache License 2.0
9 stars 44 forks source link

fix search engine optimization and find in page experience for information in accordians #1656

Open bdb-dd opened 5 months ago

bdb-dd commented 5 months ago

Description

Several of our articles use accordian components to hide certain content by default. The standard way of implementing this has been to set the css property display: none. An unfortunate side effect of this, however, is that the hidden content is unavailable when using the in-page search function in the browser.

This article describes how to use an alternative approach that fixes this issue.

In particular, our Common deps page would be improved by implementing this change. Some work may be needed to deal with the caveats listed.

This new css feature is not yet supported by all browsers, but a backwards compatible implementation is possible.

https://caniuse.com/?search=until-found

bdb-dd commented 5 months ago

Note: it appears that this issue is not limited to the "find in page" functionality of the browser. Having run into this behaviour while investigating "holes" in the training dataset for Altinn Assistant, I can now confirm that this issue also affects the ability for external crawlers to index the Accordian content.

Here is an example search that should return the following page, under gridProps: https://docs.altinn.studio/app/development/ux/components/commondefs/

bdb-dd commented 5 months ago

A candidate fix is available for testing here.

Further work should be done to better support toggling on browsers lacking support for the hidden="until-found"attribute value.

bdb-dd commented 5 months ago

Further analysis has shown that the SEO problems are probably not related to the accordian and I have been able to isolate the challenge for the Assistant crawler to differences in HTML structure, rather than accordians in general. Main issue text updated.