Files
bqkc/_includes/index/featured-terms.html
Nasir Anthony Montalvo 16adda8c47 Update documentation and permalinks for consistency and clarity
- Changed references in markup.md to update "data.html" to "data/" for clarity.
- Updated metadata.md to correct the link to the general documentation.
- Modified navbar.md to ensure stub values match the new permalink structure.
- Adjusted tables.md to reflect the new permalink for the table visualization page.
- Updated about.md to change the permalink from "/about.html" to "/about/" and revised content for clarity and impact.
- Changed browse.md permalink from "/browse.html" to "/browse/" for consistency.
- Added copyright.md page with copyright information and terms of use.
- Updated data.md to change permalink from "/data.html" to "/data/" and added introductory content.
- Created donate.md page to facilitate donations and acknowledge supporters.
- Updated locations.md permalink from "/locations.html" to "/locations/" for consistency.
- Changed map.md permalink from "/map.html" to "/map/" for uniformity.
- Added erasure.md page discussing the historical context of Black queer Kansas Citians.
- Updated out-there.md to correct the link to Lea Hopkins' interview.
- Changed subjects.md permalink from "/subjects.html" to "/subjects/" for consistency.
- Updated timeline.md permalink from "/timeline.html" to "/timeline/" for uniformity.
2026-01-15 00:45:32 -06:00

54 lines
3.0 KiB
HTML

{% comment %}
Featured Terms button-links.
This include creates a card with btn links to the Browse page from a set of automatically generated or manually selected terms. Either use the "field" option to auto generate *or* the "featured" option to manually create list of terms.
E.G. --> {% include index/featured-terms.html field="subject" title="Top Subjects" btn-color="outline-info" max=8 %}
E.G. --> {% include index/featured-terms.html featured="Example term; Another; One more" title="Topic Areas" btn-color="success" %}
Options:
- "field" - a field from your metadata that will be used to auto generate top terms (required to auto generate)
- "featured" - a manually created list of featured terms, separated by ; semicolon (required if not auto generating from a field)
- "title" - card title text inside card content area (optional)
- "header" = card header text in bar above card content (optional)
- "heading_level" = customize the level of the heading if necessary for accessibility, choose "h1", "h2", "h3", etc (optional, default "h2")
- "max" - max number of terms to display if auto generating (optional, default 5)
- "btn-color" - a bootstrap color class to theme the buttons. Can be any bootstrap template color (e.g. info, success) or outline (e.g. outline-info, outline-success), including colors created in config-theme-colors. (optional, default "primary")
Requires CB's "array_count_uniq.rb" plugin!
{%- endcomment -%}
{% if include.featured %}
{% assign topTerms = include.featured | split: ";" %}
{%- else -%}
{% comment %}
Use termsField and termsMax to customize feature
{% endcomment %}
{% assign termsField = include.field | default: "subject" %}
{% assign termsMax = include.max | default: 5 %}
{% if site.data.theme.browse-child-objects == true %}
{%- assign terms = site.data[site.metadata] | where_exp: 'item','item.objectid' | map: termsField | join: ";" -%}
{% else %}
{%- assign terms = site.data[site.metadata] | where_exp: 'item','item.parentid == nil' | map: termsField | join: ";" -%}
{%- endif -%}
{%- assign uniqTerms = terms | downcase | split: ";" | array_count_uniq -%}
{% capture topTerms %}
{% for i in uniqTerms limit: termsMax %}{{ i[0] }};{% endfor %}{% endcapture %}
{% assign topTerms = topTerms | split: ";" %}
{%- endif -%}
<div class="card mb-3">
{% if include.header %}<{{ include.heading_level | default: 'h2' | strip }} class="card-header h5">{{ include.header }}</{{ include.heading_level | default: 'h2' | strip }}>{% endif %}
<div class="card-body">
{% if include.title %}<{{ include.heading_level | default: 'h2' | strip }} class="card-title h5">{{ include.title }}</{{ include.heading_level | default: 'h2' | strip }}>{% endif %}
<p class="card-text">
{% for s in topTerms %}
<a class="btn btn-sm btn-{{ include.btn-color | default: 'primary' }} m-1" href="{{ s | strip | url_param_escape | prepend: ':' | prepend: termsField | prepend: '/browse/#' | relative_url }}">{{ s | strip }}</a>{% endfor %}
</p>
</div>
</div>