Skip to content

Commit

Permalink
Minor update for wsaw
Browse files Browse the repository at this point in the history
  • Loading branch information
rgravitvl committed Dec 11, 2024
1 parent 152e0a5 commit c775486
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blocks/card-list/card-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import createApplicationCard from './applicationCard.js';
import { makePublicUrl } from '../../scripts/scripts.js';
import { buildItemListSchema } from '../../scripts/schema.js';

const tagName = getMetadata('template') === 'wsaw' ? 'solutions' : 'topics';
const tagName = getMetadata('template') === 'wsawHub' ? 'solutions' : 'topics';

const getSelectionFromUrl = () => (window.location.pathname.indexOf(tagName) > -1 ? toClassName(window.location.pathname.replace('.html', '').split('/').pop()) : '');
const getPageFromUrl = () => toClassName(new URLSearchParams(window.location.search).get('page')) || '';
Expand Down Expand Up @@ -147,16 +147,16 @@ export function createFilters(articles, viewAll = false) {
}

export default async function decorate(block) {
block.setAttribute('id', 'card-list');
const articleType = block.classList.length > 2 ? block.classList[1] : '';
if (articleType) block.classList.remove(articleType);
block.textContent = '';
const indexType = getMetadata('template') === 'wsawHub' ? 'wsaw' : 'article';

const indexType = getMetadata('template') === 'wsaw' ? 'wsaw' : 'article';
const contentType = getMetadata('template') === 'wsaw' ? 'weseeaway' : articleType;
// fetch and sort all articles
const articles = await ffetch(`/us/en/${indexType}-index.json`)
.chunks(500)
.filter(({ type }) => type.toLowerCase() === contentType)
.filter(({ type }) => type.toLowerCase() === articleType)
.filter((article) => !article.path.includes('/topics-template'))
.all();
let filteredArticles = articles;
Expand Down
2 changes: 2 additions & 0 deletions helix-query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ indices:
wsaw:
include:
- /us/en/we-see-a-way/**
exclude:
- /us/en/we-see-a-way
target: /us/en/wsaw-index.json
properties:
lastModified:
Expand Down

0 comments on commit c775486

Please sign in to comment.