mirror of
https://github.com/kremalicious/blog.git
synced 2025-01-03 18:35:07 +01:00
trying to fix feed images
This commit is contained in:
parent
4f3de419e1
commit
0c60576f26
@ -144,20 +144,21 @@ module.exports = {
|
|||||||
feeds: [
|
feeds: [
|
||||||
{
|
{
|
||||||
serialize: ({ query: { site, allMarkdownRemark } }) => {
|
serialize: ({ query: { site, allMarkdownRemark } }) => {
|
||||||
return allMarkdownRemark.edges.map(edge => {
|
return allMarkdownRemark.edges.map(edge => ({
|
||||||
return Object.assign({}, edge.node.frontmatter, {
|
title: edge.node.frontmatter.title,
|
||||||
description: feedContent(edge),
|
date: edge.node.fields.date,
|
||||||
url: site.siteMetadata.siteUrl + edge.node.fields.slug,
|
description: feedContent(edge),
|
||||||
author: site.siteMetadata.author,
|
url: site.siteMetadata.siteUrl + edge.node.fields.slug,
|
||||||
guid: site.siteMetadata.siteUrl + edge.node.fields.slug
|
categories: edge.node.frontmatter.tags,
|
||||||
})
|
author: site.siteMetadata.author,
|
||||||
})
|
guid: site.siteMetadata.siteUrl + edge.node.fields.slug
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
query: `
|
query: `
|
||||||
{
|
{
|
||||||
allMarkdownRemark(
|
allMarkdownRemark(
|
||||||
limit: 20,
|
sort: { order: DESC, fields: [fields___date] },
|
||||||
sort: { order: DESC, fields: [fields___date] }
|
limit: 20
|
||||||
) {
|
) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@ -167,7 +168,7 @@ module.exports = {
|
|||||||
title
|
title
|
||||||
image {
|
image {
|
||||||
childImageSharp {
|
childImageSharp {
|
||||||
resize(width: 960, quality: 80) {
|
resize(width: 940, quality: 85) {
|
||||||
src
|
src
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,8 +197,11 @@ module.exports = {
|
|||||||
|
|
||||||
const feedContent = edge => {
|
const feedContent = edge => {
|
||||||
const { image } = edge.node.frontmatter
|
const { image } = edge.node.frontmatter
|
||||||
|
const { html } = edge.node
|
||||||
|
const footer =
|
||||||
|
'<hr />This post was published on <a href="https://kremalicious.com">kremalicious.com</a>'
|
||||||
|
|
||||||
return image
|
return image
|
||||||
? `<img src="${image.childImageSharp.resize.src}" /><br />${edge.node.html}`
|
? `<img src="${image.childImageSharp.resize.src}" /><br />${html}${footer}`
|
||||||
: edge.node.html
|
: `${html}${footer}`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user