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

Improve social media preview #3163

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

svenseeberg
Copy link
Member

@svenseeberg svenseeberg commented Oct 31, 2024

Short description

Improve the social media previews.

More info: https://chat.tuerantuer.org/digitalfabrik/pl/rnoez75xxjyhugxo97mbjuqmte & https://tasks.tuerantuer.org/projects/infra/work_packages/3734/activity?query_id=59

Previews on Signal and WhatsApp are not yet working.

Proposed changes

  • Improve edge case handling in excerpts.

Side effects

  • N/A

Pull Request Review Guidelines

@svenseeberg svenseeberg force-pushed the feature/improve-social-media-previews branch from 35489de to 83348ce Compare October 31, 2024 15:18
strip_tags(content.replace("\n", " ").replace("\r", "").replace("<br>", " "))
)
if len(stripped_content) <= 100:
return stripped_content.strip().replace(" ", " ")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this line? :)

Copy link
Member Author

@svenseeberg svenseeberg Oct 31, 2024

Choose a reason for hiding this comment

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

For example

Hallo<br>
Welt

will evaluate to Hallo Welt as we replaced newlines and br tags with empty spaces in line 51.

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.

2 participants