Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make common component properties available to web content crawlers #1665

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions layouts/shortcodes/common-defs-expandlarge.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@
{{end}}
</a>
</div>
<div id="expandable-{{with $title}}{{.}}{{else}}expand-default{{end}}" class="a-collapseContent collapse" role="tabpanel">
<div id="expandable-{{with $title}}{{.}}{{else}}expand-default{{end}}"
class="a-collapseContent-searchable" role="tabpanel" hidden="until-found">
<div class="a-collapseContent-inside">
<a name="#{{$title}}"></a>
{{- template "list-descriptions" (dict "property" $def "propName" $title) -}}
</div>
</div>
</div>
{{- end -}}
{{- end -}}
{{- end -}}


<script lang="javascript">
// if (!('onbeforematch' in document.body)) {
// // fallback to original behavior
// document.addEventListener('DOMContentLoaded', (event) => {
// let divs = document.querySelectorAll('div.a-collapseContent-searchable');
// divs.forEach((div) => {
// div.classList.remove('a-collapseContent-searchable');
// div.classList.add('a-collapseContent');
// });
// });
// }
</script>
25 changes: 25 additions & 0 deletions themes/hugo-theme-altinn/static/css/designsystem.css
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,31 @@ template {
[hidden] {
display: none !important; }

.a-collapseContent-searchable.collapse {
display: block;
content-visibility: hidden;
}

.a-collapseContent-searchable[hidden=until-found] {
display: block !important;
content-visibility: hidden;
}

.a-collapseContent-searchable.collapsing[hidden=until-found] {
display: block !important;
content-visibility: visible;
}

.a-collapseContent-searchable.collapse.show {
display: block;
content-visibility: visible;
}

.a-collapseContent-searchable.collapse.show[hidden=until-found] {
display: block;
content-visibility: visible;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
margin-bottom: 6px;
Expand Down
Loading