From 031bb755dc94256ff97f470ede3ffe24755878ad Mon Sep 17 00:00:00 2001 From: andyLaptop Date: Tue, 6 Jan 2026 18:35:33 -0800 Subject: [PATCH] docs/Update html tags and docs --- packages/11ty/_includes/README.md | 2 +- .../11ty/_includes/components/abstract.js | 1 + .../_includes/components/head-tags/jsonld.js | 43 +++++++++---------- packages/11ty/_includes/components/head.js | 2 +- .../11ty/_includes/components/link-list.js | 2 +- .../11ty/_includes/components/menu/index.js | 2 +- .../11ty/_includes/components/modal/index.js | 1 + .../11ty/_includes/components/navigation.js | 32 +++++++------- .../11ty/_includes/components/page-buttons.js | 22 +++++++--- packages/11ty/_includes/components/search.js | 12 +++--- .../table-of-contents/item/image.js | 2 +- 11 files changed, 67 insertions(+), 54 deletions(-) diff --git a/packages/11ty/_includes/README.md b/packages/11ty/_includes/README.md index ab139ff1c..a045326c2 100644 --- a/packages/11ty/_includes/README.md +++ b/packages/11ty/_includes/README.md @@ -6,7 +6,7 @@ Use [Liquid](https://www.11ty.dev/docs/languages/liquid/) or [Nunjucks](https:// ### `_includes/components` -The `_include/components` implement _cross templating language_ includes, also refered to as "shortcode components" because they are registered as Eleventy shortcodes (see the [`components` plugin module](`blob/main/plugins/components/README.md`)) that can be used in multiple template languages. +The `_include/components` implement _cross templating language_ includes, also referred to as "shortcode components" because they are registered as Eleventy shortcodes (see the [`components` plugin module](`blob/main/plugins/components/README.md`)) that can be used in multiple template languages. Use a shortcode component when rendering the include requires using JavaScript or NPM packages, complex conditional logic or data manipulation, including async data. diff --git a/packages/11ty/_includes/components/abstract.js b/packages/11ty/_includes/components/abstract.js index 259aef3b7..4d949912a 100644 --- a/packages/11ty/_includes/components/abstract.js +++ b/packages/11ty/_includes/components/abstract.js @@ -8,6 +8,7 @@ export default function (eleventyConfig) { const markdownify = eleventyConfig.getFilter('markdownify') return function (params) { const { abstract } = params + if (!abstract) return '' return html`
diff --git a/packages/11ty/_includes/components/head-tags/jsonld.js b/packages/11ty/_includes/components/head-tags/jsonld.js index 7ead72a67..ad1ffaab0 100644 --- a/packages/11ty/_includes/components/head-tags/jsonld.js +++ b/packages/11ty/_includes/components/head-tags/jsonld.js @@ -17,16 +17,15 @@ export default function (eleventyConfig) { return function ({ canonicalURL, page }) { const { abstract, contributor, cover, title } = page const pageContributors = contributor - ? contributor - .map((contributor, { id }) => { - contributor = id ? publication.contributor[id] : contributor - if (!contributor) return {} - const { full_name, first_name, last_name } = contributor - return { - type: 'Person', - name: full_name || `${first_name} ${last_name}` - } - }) + ? contributor.map((entry) => { + const resolved = entry.id ? publication.contributor[entry.id] : entry + if (!resolved) return {} + const { full_name, first_name, last_name } = resolved + return { + '@type': 'Person', + name: full_name || `${first_name} ${last_name}` + } + }) : [] const publicationContributors = publication.contributor @@ -34,7 +33,7 @@ export default function (eleventyConfig) { .map((contributor) => { const { full_name, first_name, last_name } = contributor return { - type: 'Person', + '@type': 'Person', name: full_name || `${first_name} ${last_name}`, jobTitle: contributor.title, affiliation: contributor.affiliation, @@ -46,19 +45,19 @@ export default function (eleventyConfig) { const publicationDescription = publication.description.full || '' const Book = { - type: 'Book', + '@type': 'Book', name: publication.title, description: publicationDescription.replace(/\n/g, ' '), isbn: isbn && isbn.replace(/-/g, '') } const Periodical = { - type: 'PublicationIssue', + '@type': 'PublicationIssue', name: publication.title, description: publicationDescription.replace(/\n/g, ' '), issueNumber: publication.series_issue_number, isPartOf: { - type: 'Periodical', + '@type': 'Periodical', name: publication.title, issn: publication.identifier.issn } @@ -66,7 +65,7 @@ export default function (eleventyConfig) { // publication.pub_type === null const WebSite = { - type: 'WebSite', + '@type': 'WebSite', name: publication.title } @@ -90,17 +89,17 @@ export default function (eleventyConfig) { '/ulan/': 'Person' } return { - type: vocab[identifier] || 'Thing', + '@type': vocab[identifier] || 'Thing', name, - identifier + sameAs: identifier } }) const publisher = { - type: 'Organization', + '@type': 'Organization', name: publication.publisher.name, location: { - type: 'PostalAddress', + '@type': 'PostalAddress', addressLocality: publication.publisher.location }, identifier: publication.publisher.url @@ -111,14 +110,14 @@ export default function (eleventyConfig) { author: [...pageContributors], description: abstract && abstract.replace(/\n/g, ' '), headline: title, - image: cover && path.join(imageDir, cover), + image: cover && new URL(path.join(imageDir, cover), publication.url).href, partOf: { ...partOf(publication.pub_type), about, author: [...publicationContributors], datePublished: publication.pub_date, dateModified: publication.revision_history.date, - image: publication.promo_image && path.join(imageDir, publication.promo_image), + image: publication.promo_image && new URL(path.join(imageDir, publication.promo_image), publication.url).href, license: publication.license.url, keywords: publication.subject .filter(({ type }) => type === 'keyword') @@ -132,7 +131,7 @@ export default function (eleventyConfig) { return JSON.stringify( { - '@context': 'http://schema.org/', + '@context': 'https://schema.org', ...Article } ) diff --git a/packages/11ty/_includes/components/head.js b/packages/11ty/_includes/components/head.js index b6568d75d..8c2a4d576 100644 --- a/packages/11ty/_includes/components/head.js +++ b/packages/11ty/_includes/components/head.js @@ -24,7 +24,7 @@ export default function (eleventyConfig) { title ? `${title} | ${publication.title}` : publication.title ) - const description = publication.description.full || publication.description.one_line + const description = abstract || publication.description.full || publication.description.one_line const publisherLinks = publication.publisher .filter(({ url }) => url) diff --git a/packages/11ty/_includes/components/link-list.js b/packages/11ty/_includes/components/link-list.js index d849cd7c7..29e57ec8d 100644 --- a/packages/11ty/_includes/components/link-list.js +++ b/packages/11ty/_includes/components/link-list.js @@ -14,7 +14,7 @@ export default function (eleventyConfig) { return function (params) { const { links, classes = [] } = params - if (!links) return '' + if (!links || links.length === 0) return '' return html`
- + ` } } diff --git a/packages/11ty/_includes/components/table-of-contents/item/image.js b/packages/11ty/_includes/components/table-of-contents/item/image.js index 9774f1f33..dc69fbff6 100644 --- a/packages/11ty/_includes/components/table-of-contents/item/image.js +++ b/packages/11ty/_includes/components/table-of-contents/item/image.js @@ -20,7 +20,7 @@ export default function (eleventyConfig) { return html`
- ${alt} + ${alt}
`