Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(markdown): don't create excerpt if there is no <!--more--> #1801

Merged
merged 1 commit into from Jan 13, 2023

Conversation

Qwertovsky
Copy link
Contributor

@Qwertovsky Qwertovsky commented Jan 6, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

If there is no <!-- more --> divider in the text then the excerpt is a copy of full content.

This change adds new boolean variable excerptIsBody into the document next to excerpt.

  • It can help to improve performance and don't process the excerpt (just make a copy of body).
  • It can help to don't show link to full text if there is nothing to read more.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Jan 6, 2023

βœ… Deploy Preview for nuxt-content ready!

Built without sensitive environment variables

Name Link
πŸ”¨ Latest commit df40588
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt-content/deploys/63bf25cab7f408000999b90e
😎 Deploy Preview https://deploy-preview-1801--nuxt-content.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

Atinux commented Jan 6, 2023

What about making the excerpt empty instead to avoid double payload?

@nuxt nuxt deleted a comment from nuxt-studio-dev bot Jan 7, 2023
@nuxt nuxt deleted a comment from nuxt-studio-dev bot Jan 7, 2023
@farnabaz farnabaz mentioned this pull request Jan 9, 2023
7 tasks
Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having an extra field in the document, we should clear the excerpt value.

It also reduces the document sizes and smaller content chunks.

@nuxt-studio-dev
Copy link

nuxt-studio-dev bot commented Jan 9, 2023

βœ… Deploy Preview for demo-blog-nuxt-content ready!

Name Link
πŸ”¨ Latest commit df40588
😎 Deploy Preview https://content.nuxtjs.org?preview=4c5836ab8c50738f034f7b6c0412b42f

@Qwertovsky Qwertovsky changed the title feat(markdown): flag that the excerpt is a copy of the body feat(markdown): don't create excerpt if there is no <!--more--> Jan 9, 2023
@Qwertovsky
Copy link
Contributor Author

I made changes. Now the excerpt is undefined.

By default, <ContentRenderer> still shows body.

    // Get body from value
    let body = (value.body || value) as MarkdownNode
    if (ctx.excerpt && value.excerpt) {
      body = value.excerpt
    }

But this PR could be breaking change for some cases. If the excerpt is used as content property in code.

@farnabaz farnabaz merged commit 2ba0776 into nuxt:main Jan 13, 2023
@farnabaz farnabaz mentioned this pull request Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants