When using the excerpt(format: HTML) graphql value, it seems to be just showing the end of the article/blog-post instead of from the beginning.
This is regardless of the pruneLength I set.
It seems to be just showing the last node that contains text.
gatsbyjs-gatsby-12386.yarn installyarn develop --openThe excerpts should be from the beginning of the article and should be pruned according to pruneLength.
I get text from the end of the blog post that isn't controlled by the pruneLength at all.
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Shell: 5.7.1 - /usr/local/bin/zsh
Binaries:
Node: 11.10.1 - /var/folders/sb/bms_668s56dcm__8z_zp799w0000gn/T/yarn--1551995935354-0.48590971035339536/node
Yarn: 1.13.0 - /var/folders/sb/bms_668s56dcm__8z_zp799w0000gn/T/yarn--1551995935354-0.48590971035339536/yarn
npm: 6.7.0 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/local/bin/python
Browsers:
Chrome: 72.0.3626.121
Safari: 12.0.3
npmPackages:
gatsby: 2.1.24 => 2.1.24
gatsby-cli: 2.4.13 => 2.4.13
gatsby-pagination: 1.2.0 => 1.2.0
gatsby-plugin-catch-links: 2.0.12 => 2.0.12
gatsby-plugin-emotion: ^4.0.4 => 4.0.4
gatsby-plugin-favicon: ^3.1.5 => 3.1.5
gatsby-plugin-flow: 1.0.2 => 1.0.2
gatsby-plugin-google-analytics: 2.0.16 => 2.0.16
gatsby-plugin-react-helmet: 3.0.8 => 3.0.8
gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
gatsby-plugin-sharp: 2.0.25 => 2.0.25
gatsby-plugin-sitemap: 2.0.6 => 2.0.6
gatsby-plugin-svgr: 2.0.1 => 2.0.1
gatsby-plugin-typography: 2.2.8 => 2.2.8
gatsby-remark-abbr: 1.0.0 => 1.0.0
gatsby-remark-autolink-headers: 2.0.15 => 2.0.15
gatsby-remark-copy-linked-files: 2.0.9 => 2.0.9
gatsby-remark-embed-snippet: 3.2.2 => 3.2.2
gatsby-remark-emoji: 0.0.2 => 0.0.2
gatsby-remark-images: 3.0.6 => 3.0.6
gatsby-remark-prismjs: 3.2.4 => 3.2.4
gatsby-remark-responsive-iframe: 2.0.9 => 2.0.9
gatsby-remark-smartypants: 2.0.8 => 2.0.8
gatsby-remark-source-name: ^1.0.0 => 1.0.0
gatsby-source-filesystem: 2.0.23 => 2.0.23
gatsby-transformer-remark: 2.3.1 => 2.3.1
gatsby-transformer-sharp: 2.1.15 => 2.1.15
gatsby-transformer-yaml: 2.1.8 => 2.1.8
According to commit fbe4fcb0b42e6cec693029449affbc6cc0f2bdb1 it looks like @nadrane maybe didn't finish the excerpt(format: HTML) case with no excerpt separator?
Also, I think findLastTextNode() could use some unit tests... I'm nearly positive that it doesn't need the second argument (nothing seems to use it).
I think it can be simplified some:
function findLastTextNode(node) {
if (node.type === `text`) { return node }
node.children.forEach(child => {
const laterTextNode = findLastTextNode(child)
if (laterTextNode !== textNode) {
textNode = laterTextNode
}
})
return textNode
}
@docwhat think a lot of your assertions are correct.
Given Markdown content, it does not appear to be respecting the pruneLength. It doesn't seem to always start from the end, e.g. the below post seems like the _entire_ post

but certainly something does seem to be awry.
Also, I think findLastTextNode() could use some unit tests... I'm nearly positive that it doesn't need the second argument (nothing seems to use it).
Would love nothing more.
If you're interested and have some time, what I'd recommend is to:
Happy to pair with you on this--but hopefully this provides you with enough to get up and running with this bug fix. We'd love nothing more, especially if you're able to add a more exhaustive unit test suite in doing so!
I'm also happy to help out/pair as well. This code is pretty nasty, given all the tree traversals and multiple varieties of ASTs.
If I have time this weekend, I'd be happy to take a stab at a fix
I'll see about hopping on discord Friday night or on the weekend to pair. :-)
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Is this bug solved? May a option be provided to make excerpt return the whole post when there's no excerpt separator? That usage is actually more common, I think.
Most helpful comment
I'm also happy to help out/pair as well. This code is pretty nasty, given all the tree traversals and multiple varieties of ASTs.
If I have time this weekend, I'd be happy to take a stab at a fix