diff --git a/cigaradvisor/blocks/article-list/article-list.css b/cigaradvisor/blocks/article-list/article-list.css new file mode 100644 index 00000000..cf673b32 --- /dev/null +++ b/cigaradvisor/blocks/article-list/article-list.css @@ -0,0 +1 @@ +/** Dummy File for now **/ diff --git a/cigaradvisor/blocks/article-list/article-list.js b/cigaradvisor/blocks/article-list/article-list.js new file mode 100644 index 00000000..c59bd198 --- /dev/null +++ b/cigaradvisor/blocks/article-list/article-list.js @@ -0,0 +1,3 @@ +export default async function decorate(block) { + block.innerHTML = ''; +} diff --git a/cigaradvisor/blocks/article-teaser/article-teaser.css b/cigaradvisor/blocks/article-teaser/article-teaser.css index 72d7cf0b..714dec13 100644 --- a/cigaradvisor/blocks/article-teaser/article-teaser.css +++ b/cigaradvisor/blocks/article-teaser/article-teaser.css @@ -58,7 +58,7 @@ } .article-teaser.block .article-category[data-category="Cigar Makers"] { - background-color: #8e7b5c + background-color: var(--tan) } .article-teaser.block .article-category[data-category="Cigar News"] { @@ -151,14 +151,14 @@ .article-teaser.block .article-thumbnail .article-meta { font-size: 0; - color: #141414; + color: var(--clr-dark-gray); } .article-teaser.block .article-thumbnail .article-meta a { position: relative; z-index: 2; text-decoration: none; - color: #141414; + color: var(--clr-dark-gray); } .article-teaser.block .article-thumbnail .article-meta>* { diff --git a/cigaradvisor/blocks/articleheader/articleheader.css b/cigaradvisor/blocks/articleheader/articleheader.css index e1b92b09..29b81acd 100644 --- a/cigaradvisor/blocks/articleheader/articleheader.css +++ b/cigaradvisor/blocks/articleheader/articleheader.css @@ -78,7 +78,7 @@ main .articleheader-container { .articleheader.block .article-info .article-author .article-published-date { font-family: var(--ff-opensans); font-weight: 600; - color: #141414; + color: var(--clr-dark-gray); font-size: 14px; } diff --git a/cigaradvisor/blocks/authorcard/authorcard.css b/cigaradvisor/blocks/author-card/author-card.css similarity index 79% rename from cigaradvisor/blocks/authorcard/authorcard.css rename to cigaradvisor/blocks/author-card/author-card.css index 55c33953..96c60d56 100644 --- a/cigaradvisor/blocks/authorcard/authorcard.css +++ b/cigaradvisor/blocks/author-card/author-card.css @@ -1,4 +1,4 @@ -.authorcard-container { +.author-card-container { background: url('/cigaradvisor/images/author-card/media_17501a5f7bf5b4aebcf109765ead7cb5956480cbe.png'); margin-top: 50px; background-position: center; @@ -9,12 +9,12 @@ margin-bottom: 40px; } -.authorcard-wrapper::after { +.author-card-wrapper::after { display: block; clear: both; } -.authorcard-wrapper { +.author-card-wrapper { display: flex; padding-left: 0; padding-right: 0; @@ -28,11 +28,11 @@ align-content: flex-start; } -.authorcard.block { +.author-card.block { display: flex; } -.authorcard.block .left-column, +.author-card.block .left-column, .right-column { display: flex; float: none; @@ -42,7 +42,7 @@ padding: 10px; } -.authorcard.block .left-column h2 { +.author-card.block .left-column h2 { font-family: var(--ff-alfaslabone); font-size: var(--heading-font-size-xl); color: var(--deep-reddish-brown); @@ -53,13 +53,13 @@ border-bottom: 30px solid; } -.authorcard.block .left-column h2:first-child { +.author-card.block .left-column h2:first-child { font-size: var(--heading-font-size-l); border-bottom: none; } -.authorcard.block .left-column p { +.author-card.block .left-column p { font-family: var(--ff-opensans); font-weight: var(--font-weight-semibold); color: var(--dark-grey); @@ -68,7 +68,7 @@ margin-top: 30px; } -.authorcard.block .left-column .button { +.author-card.block .left-column .button { background-color: var(--clr-black); border: 2px solid; font-family: var(--ff-montserrat); @@ -96,26 +96,26 @@ vertical-align: middle; } -.authorcard.block .button:hover { +.author-card.block .button:hover { transition: .5s; background-color: var(--subdued-gold); border-color: var(--subdued-gold); text-decoration: none; } -.authorcard.block .right-column .author-wrapper { +.author-card.block .right-column .author-wrapper { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; } -.authorcard.block .author-content { +.author-card.block .author-content { flex: 0 0 50%; padding: 3px; } -.authorcard.block .author-content .overlay-image { +.author-card.block .author-content .overlay-image { margin-right: -100%; background-image: none; width: 100%; @@ -126,11 +126,11 @@ height: auto; } -.authorcard.block .author-content .overlay-image img { +.author-card.block .author-content .overlay-image img { display: block; } -.authorcard.block .right-column p { +.author-card.block .right-column p { color: var(--clr-white); text-transform: uppercase; background-color: transparent; @@ -139,7 +139,7 @@ cursor: default; } -.authorcard.block .right-column p>a { +.author-card.block .right-column p>a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -149,13 +149,13 @@ font-size: var(--body-font-size-xl); } -.authorcard.block .right-column p>a:hover { +.author-card.block .right-column p>a:hover { transition: .8s; text-decoration: none; } -.authorcard.block .overlay-image:hover::before { +.author-card.block .overlay-image:hover::before { content: ""; position: absolute; top: 0; @@ -166,7 +166,7 @@ } -.authorcard.block .align-center { +.author-card.block .align-center { position: absolute; top: 50%; left: 50%; @@ -177,12 +177,12 @@ text-align: center; } -.authorcard.block .overlay-image:hover .align-center { +.author-card.block .overlay-image:hover .align-center { opacity: 1; } @media (max-width: 768px) { - .authorcard-container { + .author-card-container { padding: 60px 10px; background: none #ece8e3; background-size: auto 150%; @@ -193,16 +193,16 @@ width: 100%; } - .authorcard.block { + .author-card.block { flex-flow: column wrap; width: 100%; } - .authorcard.block .author-content { + .author-card.block .author-content { flex: 0 0 100%; } - .authorcard.block .left-column, + .author-card.block .left-column, .right-column { width: 100%; display: flex; @@ -212,13 +212,13 @@ padding: 0; } - .authorcard.block .overlay-image { + .author-card.block .overlay-image { flex: 0 0 100%; width: 100%; } - .authorcard.block .author-content .overlay-image img { + .author-card.block .author-content .overlay-image img { display: block; width: 100%; } -} \ No newline at end of file +} diff --git a/cigaradvisor/blocks/authorcard/authorcard.js b/cigaradvisor/blocks/author-card/author-card.js similarity index 100% rename from cigaradvisor/blocks/authorcard/authorcard.js rename to cigaradvisor/blocks/author-card/author-card.js diff --git a/cigaradvisor/blocks/author-detail/author-detail.css b/cigaradvisor/blocks/author-detail/author-detail.css new file mode 100644 index 00000000..be355c96 --- /dev/null +++ b/cigaradvisor/blocks/author-detail/author-detail.css @@ -0,0 +1,162 @@ + +.author-detail.block { + position: relative; + overflow: hidden; +} + +.author-detail.block .author-detail-content { + display: flex; + flex-direction: column; + align-items: center; + border: 2px solid var(--tan); + min-height: 350px; + padding: 20px 0; +} + +.author-detail.block .author-image { + max-width: 245px; + width: 100%; +} + +.author-detail.block .author-image picture { + display: block; + position: relative; + height: 100%; + width: 100%; +} + +.author-detail.block .author-image img { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + object-position: center center; + object-fit: contain; + border: 1px solid var(--tan); +} + +.author-detail.block .author-info { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + border: none; + padding: 20px; + margin-top: 20px; + text-align: center; +} + +.author-detail.block .author-info .author-name { + font-size: var(--heading-font-size-xxs); + font-weight: var(--font-weight-heavy); + line-height: var(--line-height-m); + text-align: center; + font-family: montserrat, sans-serif; + color: var(--clr-dark-gray); +} + +.author-detail.block .author-info .author-title { + font-style: italic; + font-size: var(--body-font-size-l); + font-weight: var(--font-weight-normal); + line-height: var(--line-height-m); + margin: 0 15px; +} + +.author-detail.block .author-intro { + margin: 12px 0; +} + +.author-detail.block .author-intro p { + line-height: var(--line-height-xl); + font-weight: var(--font-weight-bold); + margin: 0; +} + +.author-detail.block .social-links ul { + display: flex; + justify-content: center; + align-items: center; + margin: 0; + gap: 25px; +} + +.author-detail.block picture.bg-image { + max-height: 300px; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: -1; +} + +.author-detail.block picture.bg-image img { + object-position: center center; + object-fit: cover; + width: 100%; + height: 100%; +} + + +/* media queries */ +@media screen and (min-width: 900px) { + .author-detail.block { + padding-top: 200px; + } + + .author-detail.block picture.bg-image { + max-height: unset; + } + + .author-detail.block .author-detail-content { + padding: 0 20px; + max-width: 1076px; + margin: 0 auto; + flex-direction: row; + align-items: center; + border: 2px solid var(--tan); + background-color: var(--clr-white); + } + + .author-detail.block .author-info { + align-items: flex-start; + text-align: left; + margin-top: 0; + padding: 50px; + } + + .author-detail.block .author-heading-wrapper { + display: flex; + align-items: center; + } + + .author-detail.block .author-info .author-name { + font-size: var(--heading-font-size-s); + } + + .author-detail.block .author-info .author-title { + font-size: var(--body-font-size-xxl); + } + + .author-detail.block .social-links ul { + justify-content: flex-start; + } +} + +@media screen and (min-width: 1200px) { + .author-detail.block .author-image { + transform: translate(-22%, -32%); + } + + .author-detail.block .author-image picture { + width: 245px; + padding-bottom: 0; + } + + .author-detail.block .author-info .author-intro p { + font-size: var(--body-font-size-s); + line-height: var(--line-height-l); + } +} diff --git a/cigaradvisor/blocks/author-detail/author-detail.js b/cigaradvisor/blocks/author-detail/author-detail.js new file mode 100644 index 00000000..426b9e76 --- /dev/null +++ b/cigaradvisor/blocks/author-detail/author-detail.js @@ -0,0 +1,68 @@ +import { readBlockConfig, decorateIcons, createOptimizedPicture } from '../../scripts/aem.js'; + +export default async function decorate(block) { + const config = readBlockConfig(block); + const social = block.querySelector('ul'); + const picture = block.querySelector('picture'); + const img = picture.querySelector('img'); + const ratio = (parseInt(img.height, 10) / parseInt(img.width, 10)) * 100; + picture.style.paddingBottom = `${ratio}%`; + + if (social) { + const links = social.querySelectorAll('a'); + links.forEach((link) => { + const text = link.textContent; + link.textContent = ''; + const textToClass = text.trim().toLowerCase().replace(/\s/g, '-'); + link.setAttribute('title', `${config.name} on ${text}`); + if (textToClass && textToClass !== '') { + let icon; + switch (textToClass) { + case 'twitter': + case 'x': + case 'x-twitter': + icon = 'x-twitter'; + break; + case 'facebook': + icon = 'facebook-f'; + break; + case 'instagram': + icon = 'instagram'; + break; + case 'youtube': + icon = 'youtube'; + break; + case 'pintrest': + icon = 'pintrest-p'; + break; + default: + icon = 'unknown'; + } + link.innerHTML = ``; + } + }); + } + block.innerHTML = ` +
+ `; + const bg = createOptimizedPicture('https://main--famous-smoke-cigaradvisor--hlxsites.hlx.page/cigaradvisor/images/backgrounds/author.jpg', '', true); + bg.classList.add('bg-image'); + block.append(bg); + decorateIcons(block); +} diff --git a/cigaradvisor/blocks/author/author.css b/cigaradvisor/blocks/author-teaser/author-teaser.css similarity index 89% rename from cigaradvisor/blocks/author/author.css rename to cigaradvisor/blocks/author-teaser/author-teaser.css index 85f8236b..68624c49 100644 --- a/cigaradvisor/blocks/author/author.css +++ b/cigaradvisor/blocks/author-teaser/author-teaser.css @@ -23,15 +23,15 @@ .author.block .image-wrapper img { width: 100%; max-width: 300px; - border: 1px solid #8e7b5c; + border: 1px solid var(--tan); } .author.block .author-details { display: flex; flex-direction: column; align-items: center; - border-top: 2px solid #141414; - border-bottom: 2px solid #141414; + border-top: 2px solid var(--clr-dark-gray); + border-bottom: 2px solid var(--clr-dark-gray); text-align: center; width: 100%; margin-top: 20px; @@ -54,7 +54,7 @@ text-align: center; font-family: montserrat, sans-serif; font-weight: 900; - color: #141414; + color: var(--clr-dark-gray); } .author.block .author-details .author-heading h3 { @@ -64,7 +64,7 @@ font-size: 14px; font-family: var(--ff-opensans); font-weight: 600; - color: #141414; + color: var(--clr-dark-gray); cursor: default; display: inline-block; } @@ -117,8 +117,8 @@ align-items: flex-start; display: flex; flex-direction: column; - border-top: 2px solid #141414; - border-bottom: 2px solid #141414; + border-top: 2px solid var(--clr-dark-gray); + border-bottom: 2px solid var(--clr-dark-gray); text-align: left; width: 75%; margin-top: 0; diff --git a/cigaradvisor/blocks/author/author.js b/cigaradvisor/blocks/author-teaser/author-teaser.js similarity index 100% rename from cigaradvisor/blocks/author/author.js rename to cigaradvisor/blocks/author-teaser/author-teaser.js diff --git a/cigaradvisor/blocks/fragment/fragment.js b/cigaradvisor/blocks/fragment/fragment.js index 648a70e1..45e48792 100644 --- a/cigaradvisor/blocks/fragment/fragment.js +++ b/cigaradvisor/blocks/fragment/fragment.js @@ -33,7 +33,7 @@ export async function loadFragment(path) { resetAttributeBase('img', 'src'); resetAttributeBase('source', 'srcset'); - decorateMain(main); + await decorateMain(main); await loadBlocks(main); return main; } diff --git a/cigaradvisor/blocks/hero/hero.js b/cigaradvisor/blocks/hero/hero.js index b8ba11bb..9cc8b6d5 100644 --- a/cigaradvisor/blocks/hero/hero.js +++ b/cigaradvisor/blocks/hero/hero.js @@ -23,13 +23,19 @@ export default async function decorate(block) { if (style) { block.classList.add(style.toLowerCase()); } - - const header = block.querySelector('h1'); const image = document.createElement('div'); image.classList.add('hero-image'); image.replaceChildren(block.querySelector('picture')); + const content = document.createElement('div'); content.classList.add('hero-content'); - content.append(header, buildSearch()); + + const header = block.querySelector('h1'); + if (header) { + content.append(header); + } + if (block.classList.contains('search')) { + buildSearch(); + } block.replaceChildren(image, content); } diff --git a/cigaradvisor/scripts/scripts.js b/cigaradvisor/scripts/scripts.js index 4a0a16ce..3a024175 100644 --- a/cigaradvisor/scripts/scripts.js +++ b/cigaradvisor/scripts/scripts.js @@ -38,61 +38,30 @@ function buildHeroBlock(main) { } /** - * Builds the article header for the given main element. - * @param {HTMLElement} mainEl - The main element to build the article header for. + * Imports a template specific JS file for decorating the page with auto-blocks, etc. + * @param main */ -function buildArticleHeader(mainEl) { - if (!document.querySelector('body.blog-post-template')) { +async function decorateTemplate(main) { + // Nothing to process + const template = getMetadata('template'); + if (!template) { return; } - // eslint-disable-next-line no-use-before-define - decorateExternalLink(mainEl); - const paragraphs = mainEl.querySelectorAll('p'); - paragraphs.forEach((paragraph) => { - if (paragraph.querySelector('picture') !== null) { - const imageWrapper = document.createElement('div'); - imageWrapper.classList.add('article-image-wrapper'); - if (paragraph.querySelector('a') !== null) { - const a = paragraph.querySelector('a'); - a.replaceChildren(paragraph.querySelector('picture')); - imageWrapper.append(a); - } else { - imageWrapper.append(paragraph.querySelector('picture')); - } - const nextSibling = paragraph.nextElementSibling; - if (nextSibling && nextSibling.tagName === 'P' && nextSibling.querySelector('em')) { - nextSibling.classList.add('article-image-caption'); - imageWrapper.append(nextSibling); - } - paragraph.replaceChildren(imageWrapper); - } - }); - const h3 = mainEl.querySelectorAll('h3'); - h3.forEach((heading) => { - const p = document.createElement('p'); - p.innerHTML = ' '; - heading.prepend(p); - }); - const div = document.createElement('div'); - const h1 = mainEl.querySelector('h1'); - const picture = mainEl.querySelector('picture'); - const category = getMetadata('category'); - const authorLink = getMetadata('author'); - const publishedDate = getMetadata('publisheddate'); - const readTime = document.querySelector('meta[name="readingtime"]').content; - const articleBlurb = getMetadata('articleblurb'); - const articleHeaderBlockEl = buildBlock('articleheader', [ - [picture], - [`${category}
`], - [h1], - [`${readTime}
`], - [` `], - [`${publishedDate}
`], - [`${articleBlurb}
`], - ]); - div.append(articleHeaderBlockEl); - mainEl.prepend(div); + // Protect against recursion from fragment block + if (!main.closest(`.${template}`)) { + return; + } + const name = template.replace('-template', ''); + try { + const tpl = await import(`${window.hlx.codeBasePath}/scripts/templates/${name}.js`); + if (tpl.default) { + await tpl.default(main); + } + } catch (error) { + // eslint-disable-next-line no-console + console.log(`failed to load template script for ${name}`, error); + } } /** @@ -163,10 +132,10 @@ async function loadFonts() { * Builds all synthetic blocks in a container element. * @param {Element} main The container element */ -function buildAutoBlocks(main) { +async function buildAutoBlocks(main) { try { buildHeroBlock(main); - buildArticleHeader(main); + await decorateTemplate(main); } catch (error) { // eslint-disable-next-line no-console console.error('Auto Blocking failed', error); @@ -178,11 +147,11 @@ function buildAutoBlocks(main) { * @param {Element} main The main element */ // eslint-disable-next-line import/prefer-default-export -export function decorateMain(main) { +export async function decorateMain(main) { // hopefully forward compatible button decoration decorateButtons(main); decorateIcons(main); - buildAutoBlocks(main); + await buildAutoBlocks(main); decorateSections(main); decorateBlocks(main); buildTwoColumnGrid(main); @@ -312,7 +281,7 @@ async function loadEager(doc) { decorateTemplateAndTheme(); const main = doc.querySelector('main'); if (main) { - decorateMain(main); + await decorateMain(main); document.body.classList.add('appear'); await waitForLCP(LCP_BLOCKS); } diff --git a/cigaradvisor/scripts/templates/blog-post.js b/cigaradvisor/scripts/templates/blog-post.js new file mode 100644 index 00000000..31c1b26f --- /dev/null +++ b/cigaradvisor/scripts/templates/blog-post.js @@ -0,0 +1,53 @@ +import { decorateExternalLink } from '../scripts.js'; +import { buildBlock, getMetadata } from '../aem.js'; + +export default async function decorate(main) { + // eslint-disable-next-line no-use-before-define + decorateExternalLink(main); + const paragraphs = main.querySelectorAll('p'); + paragraphs.forEach((paragraph) => { + if (paragraph.querySelector('picture') !== null) { + const imageWrapper = document.createElement('div'); + imageWrapper.classList.add('article-image-wrapper'); + if (paragraph.querySelector('a') !== null) { + const a = paragraph.querySelector('a'); + a.replaceChildren(paragraph.querySelector('picture')); + imageWrapper.append(a); + } else { + imageWrapper.append(paragraph.querySelector('picture')); + } + const nextSibling = paragraph.nextElementSibling; + if (nextSibling && nextSibling.tagName === 'P' && nextSibling.querySelector('em')) { + nextSibling.classList.add('article-image-caption'); + imageWrapper.append(nextSibling); + } + paragraph.replaceChildren(imageWrapper); + } + }); + const h3 = main.querySelectorAll('h3'); + h3.forEach((heading) => { + const p = document.createElement('p'); + p.innerHTML = ' '; + heading.prepend(p); + }); + const div = document.createElement('div'); + const h1 = main.querySelector('h1'); + const picture = main.querySelector('picture'); + const category = getMetadata('category'); + const authorLink = getMetadata('author'); + const publishedDate = getMetadata('publisheddate'); + const readTime = document.querySelector('meta[name="readingtime"]').content; + const articleBlurb = getMetadata('articleblurb'); + + const articleHeaderBlockEl = buildBlock('articleheader', [ + [picture], + [`${category}
`], + [h1], + [`${readTime}
`], + [` `], + [`${publishedDate}
`], + [`${articleBlurb}
`], + ]); + div.append(articleHeaderBlockEl); + main.prepend(div); +} diff --git a/cigaradvisor/styles/reset.css b/cigaradvisor/styles/reset.css new file mode 100644 index 00000000..adb2bf91 --- /dev/null +++ b/cigaradvisor/styles/reset.css @@ -0,0 +1,67 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, button, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + + /* stylelint-disable-next-line declaration-block-no-shorthand-property-overrides */ + font: inherit; + vertical-align: baseline; +} + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} + +source { + font-size: 0; +} + +body { + line-height: 1; +} + +ol, ul { + list-style: none; +} + +blockquote, q { + quotes: none; +} + +blockquote::before, blockquote::after, +q::before, q::after { + content: ''; + content: none; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +button { + padding: 0; + background: none; + border: none; + color: inherit; +} diff --git a/cigaradvisor/styles/styles.css b/cigaradvisor/styles/styles.css index d9695a24..89b288b1 100644 --- a/cigaradvisor/styles/styles.css +++ b/cigaradvisor/styles/styles.css @@ -10,6 +10,8 @@ * governing permissions and limitations under the License. */ +@import url('reset.css'); + @font-face { font-family: 'Open Sans Fallback'; font-style: normal; @@ -155,13 +157,6 @@ --ff-montserrat: 'Montserrat', 'Montserrat Fallback', sans-serif; --ff-alfaslabone: 'Alfa Slab One', 'Alfa Slab One Fallback', cursive; - /* body sizes */ - --text-size-xs: 12px; - --text-size-sm: 14px; - --text-size-md: 16px; - --text-size-lg: 18px; - --text-size-xl: 24px; - /* heading sizes */ --heading-font-size-xxs: 18px; --heading-font-size-xs: 20px; @@ -171,7 +166,7 @@ --heading-font-size-xl: 40px; /* Font Weights */ - --font-weight-extrabold: 900; + --font-weight-heavy: 900; --font-weight-bold: 700; --font-weight-semibold: 600; --font-weight-normal: 400; @@ -187,9 +182,16 @@ --body-font-size-xl: 20px; --body-font-size-xxl: 24px; + /* Line Heights */ + --line-height-xs: 1.15em; + --line-height-s: 1.25em; + --line-height-m: 1.5em; + --line-height-l: 1.75em; + --line-height-xl: 2em; + /* misc */ --nav-height: 100px; - --icon-size: var(--text-size-xl); + --icon-size: var(--body-font-size-xxl); } body { diff --git a/helix-query.yaml b/helix-query.yaml index 6945c2f9..2bfcf8ea 100644 --- a/helix-query.yaml +++ b/helix-query.yaml @@ -58,27 +58,33 @@ indices: - /cigaradvisor/author/** target: /cigaradvisor/author/query-index.json properties: - name: - select: div:nth-of-type(1) > h2:nth-of-type(1) - value: textContent(el) title: - select: div:nth-of-type(1) > h3:nth-of-type(1) + select: head > title value: textContent(el) description: - select: div:nth-of-type(1) > p:nth-of-type(2) - value: textContent(el) + select: head > meta[property="og:description"] + value: attribute(el, "content") image: - select: div:nth-of-type(1) > p:nth-of-type(1) > picture:nth-of-type(1) > img - value: match(attribute(el, 'src'), "(?:https:\/\/[^/]+)?(.+)") + select: head > meta[property="og:image"] + value: attribute(el, "content") + name: + select: div.author-detail > div:nth-of-type(1) > div:nth-of-type(2) + value: textContent(el) + author-title: + select: div.author-detail > div:nth-of-type(2) > div:nth-of-type(2) + value: textContent(el) + intro: + select: div.author-detail > div:nth-of-type(4) > div:nth-of-type(2) + value: textContent(el) twitter: - select: div:nth-of-type(1) > ul:nth-of-type(1) > li > a + select: div.author-detail ul > li > a value: match(attribute(el, 'href'), '^https?:\/\/(?:www\.)?twitter\.com\/(?:#!\/)?@?([^/?#]*)\/?(?:[?#].*)?$') facebook: - select: div:nth-of-type(1) > ul:nth-of-type(1) > li > a + select: div.author-detail ul > li > a value: match(attribute(el, 'href'), '^https?:\/\/(?:www\.)?facebook\.com\/(?:#!\/)?@?([^/?#]*)\/?(?:[?#].*)?$') instagram: - select: div:nth-of-type(1) > ul:nth-of-type(1) > li > a + select: div.author-detail ul > li > a value: match(attribute(el, 'href'), '^https?:\/\/(?:www\.)?instagram\.com\/(?:#!\/)?@?([^/?#]*)\/?(?:[?#].*)?$') youtube: - select: div:nth-of-type(1) > ul:nth-of-type(1) > li > a + select: div.author-detail ul > li > a value: match(attribute(el, 'href'), '^https?:\/\/(?:www\.)?youtube\.com\/user\/(?:#!\/)?@?([^/?#]*)\/?(?:[?#].*)?$')