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

Handle the case, when a post with no title is displayed in the feed. #96

Open
wandrien opened this issue Sep 1, 2018 · 0 comments
Open

Comments

@wandrien
Copy link

wandrien commented Sep 1, 2018

It is possible that the title field accidentaly isn't set or intentionaly left empty in the site DB. In that case, we have the following in the feed:

untitled-1

It looks ugly, and we also cannot navigate directly to the post, since the title is the link.

The problem can be solved on the site's side, if the correct SQL query is used. For example:

		@follow.addFeed("Posts", "
			SELECT
			 post_id AS event_uri,
			 'post' AS type,
			 date_published AS date_added,
			 IFNULL(NULLIF(title, ''), '(untitled)') AS title,
			 body AS body,
			 '?Post:' || post_id AS url
			FROM post", true)

In that example, IFNULL(NULLIF(title, ''), '(untitled)') replaces both NULL and the empty string with "(untitled)", so we have in the feed:

untitled-2

But I believe it is better to handle that case on the ZeroHello side. It will be applied to any site, and it also makes possible to localize the '(untitled)' string in a uniform way.

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

No branches or pull requests

1 participant