article related pages meta update and other improvements

This commit is contained in:
tmshv committed 2020-02-25 02:01:57 +03:00
1 parent 9e5ec860e8
commit 488ea6ec06
6 files changed
+41 -36

No files matched your search

+4 -2
View File
@@ -29,7 +29,9 @@ export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, pr
{articles.map((article, i) => {
const gridColumn = article.featured ? 'span 2' : 'auto'
const layout: CardLayout = article.featured ? 'featured' : 'simple'
const srcSet = article.preview.set.map(({ url, density }) => `${url} ${density}x`).join(' ')
const preview = article.preview.artifacts.medium
const src = preview.src
const srcSet = preview.set.map(({ url, density }) => `${url} ${density}x`).join(' ')
const content = !article.featured
? (
@@ -52,7 +54,7 @@ export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, pr
href={article.url}
img={{
alt: article.title,
src: article.preview.src,
src,
srcSet,
}}
layout={layout}
+16 -8
View File
@@ -51,18 +51,26 @@ export class MetaBuilder {
}
build() {
const artifact = this.image.artifacts.fb
const image = {
image: artifact.src,
imageWidth: artifact.width,
imageHeight: artifact.height,
}
const image = this.buildImage()
return meta({
...this.data,
...image,
title: this.title,
description: this.description,
title: this.title ?? undefined,
description: this.description ?? undefined,
})
}
private buildImage() {
if (!this.image) {
return null
}
const artifact = this.image.artifacts.fb
return {
image: artifact.src,
imageWidth: artifact.width,
imageHeight: artifact.height,
}
}
}
+1 -1
View File
@@ -66,7 +66,7 @@ export interface IArticle {
featured: boolean
url: string
title: string
preview: IImage
preview: ImageDefinition
}
export type Person = {