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

Refine on page news presentation #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AC-LJ
Copy link
Contributor

@AC-LJ AC-LJ commented Aug 8, 2024

Adds programatic text editing to the individual news stories.

Every news article has been checked in both dev and build/preview modes and no bugs were spotted.

The master function, truncateArticleText, contains one helper function per bulleted item to do the following:

  • apply the character limit to the raw text
  • raise the character limit for anchor element code in the source text--anchor element code doesn't appear on the page but it DOES deplete the character allowance (this helper recursively searches for additional anchor elements after each increase to the character limit)
  • clean the end of the last paragraph to make the ending ellipsis and its application uniform

The body of the master function also eliminates partial paragraphs in cases where there is more than one paragraph in the array that is made from the character-limited text, and it removes empty paragraphs that can result from extra carriage returns entered into the Hygraph interface.

Copy link

vercel bot commented Aug 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
verde-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 11:36pm

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.

1 participant