-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Feature] Improved post excerpts / previews #2166
Comments
Hey zethraeus, I really like your thinking. I just opened up a topic similar to this, which Hannah asked me to bring in here for some focus. I'll add that in below. Before I do though I just want to say I think you have a really good point about writers wanting to carefully craft previews. Do you see this is something that is filtered out of the post via a notation marking the beginning and end of such a preview, so a writer could have the option of an excerpt not being out of the content in the post itself? From other topic: I was just thinking, given we don't have a "more" tag insertion function, and people often have quite different preferences on how they want to show content on their homepage & archives (i.e. length, stripping html or not), would this work? Both the "excerpt" and "content" helpers accept "words" and "characters" as options. The difference between the two helpers is that one strips html and the other doesn't. So what if instead of having the "excerpt" helper, we had "strip_html" as an option for the "content" helper? The functions of the two helpers could then be combined into one, with the processing method and returned value depending on the "strip_html" setting, and it could be used in a theme like: {{content characters / words="100" strip_html="true / false"}} (The "strip_html" property would default to false. If "strip_html" were true and no characters / words option were set it could still default to 50 words). If we did this, perhaps that would also lay the ground work for a UI setting to allow users to control each of these values. So perhaps under the current "Posts per page" setting there could also be something like:
The defaults on these settings could be determined by the theme, but the helper could look to see if the user had set anything in these fields, and if so override the output with those saved settings. Could this perhaps be a relatively neat and simple way to give users some control over these display settings? I may be missing something that's planned for the future advanced excerpts in line for 0.8, but if not, what do you think? I'm still something of a beginner, but looking at the current helper functions I think I'd be up for taking a run at combining them if the idea has any merit. |
I like the idea of combining the helpers, as long as we can't anticipate settings where you might have parameters that matter to one and not the other. |
As far as user tweaking of the settings perhaps the (currently hypothetical) theme admin panel should take care of this? |
I do think the idea needs some more thinking through, like perhaps doing a practical trial of the combined function while developing a few themes to see if it has any shortcomings. Its validity would also depend on if there are things I'm not aware of planned for excerpts in the future. As for theme admin panels, I wasn't thinking of adding new options to the degree a extra panel would be needed. I was only thinking along the lines of one or two extra settings that might fit in admin in the same context as does the current logo, cover, posts per page types of settings. There's a fine line between what should be an admin setting and what should be done within the theme itself. Even though a couple of new UI settings is my suggestion, if I'm honest I'd actually still rather err on the side of too few rather than too many. |
Hopefully @ErisDS can chime in a bit here, but i get the impression that there's space for community design work.
Yeah, user-facing setting overload would suck. |
Settings overload is something we're very wary of. In terms of future plans for the excerpt, I think @zethraeus has touched on all of them:
The only additional ones might be:
In my opinion excerpts and content are distinct concepts and need to have different helpers, but I'm willing to be shown I'm wrong :) |
Regarding the helpers: I agree with @ErisDS that excerpts and content are distinct concepts and should be treated that way. The difference becomes clearer if we take away the arguments: |
I had a good chat with @halfdan about this and he had what I thought was a good idea for handling post intros that would avoid needing to filter content to look for a 'more' tag. He suggested, as you mentioned above @ErisDS, using an app to handle it and having a UI element in a collapsible sidebar section where you could compose your custom index/tag archive intro. That way you would avoid adding anything too intrusive to the layout, given it's so nice to use as it is now, and you could also avoid doing anything inline. You'd also get full control over exactly what was in your intro, and you could use a section like this to handle addition of a featured/cover intro or video that the In this context, the advantage of rolling the I do see how conceptually However the consideration I'm wondering about is whether it might be easier for a theme developer to use something like What do you all think about that aspect of things? |
Hello, I was able to implement the I have described it in enough details in my blog Source code included You can see how it works if you open the main page of my site and see three dots at the bottom of that post. I don't know if it's good enough to be included in the core, but I am very happy with this implementation. |
Closing this in favour of #4017 |
(This issue is primarily intended to spark conversation and gauge interest!)
Most themes i've seen use {{excerpt}} for post snippets. Some use {{content words="#"}} or {{contents characters="#"}}. All of these options are lackluster as they remove context or content, and offer no control of the process.
An improved API would be awesome. I see two primary options:
Preview annotation could be or some nicer syntax to wrap or designate the end of the text to be shown in the preview. It could perhaps even allow for content separate from that shown in the actual post. The preview could be made available to themes with an API like {{preview}}. This could be good for writers who want to carefully craft their preview blocks. (This functionality sounds like it might be great for developing as plugin, at least initially.)
Context sensitivity in {{content}} (and {{excerpt}}) blocks is more interesting. It could make sense as default functionality, serving initially to just do better than chop text mid-sentence. Ghost could provide an API like {{content max-words="#"}} and attempt to more intelligently do sub-contenting within requested bounds.
To some extent, this could perhaps be offloaded to the Downsize script that Ghost is currently using (and I'm going to look into it!), but Downsize's job is to take arbitrary html and return shortened html and in working within that bound it both loses contextual hints from markdown, and is forced not to make assumptions that would be solid for Ghost. (For example, that the input is HTML that can be generated by markdown).
Perhaps snippeting could be done better in markdown itself? That obviously has a whole host of problems though!
The text was updated successfully, but these errors were encountered: