Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted November 3, 20204 yr I have a custom page which displays an announcement database I have built (separate from the built-in announcements system). This database syncs with an announcements board where users may post comments. I am using the Category Articles template to display my announcements but I am not happy with how the truncation is working. By default, the template renders the data like so: <section class='ipsType_normal ipsType_richText ipsType_break ipsSpacer_bottom' data-ipsTruncate data-ipsTruncate-size='7 lines' data-ipsTruncate-type='remove'> {$record->truncated()|raw} </section> I would theorize that the data-ipsTruncate-type is what determines how the truncation is handled, though I am unsure what other values are valid here. The current truncation effect seems to be doing two things: Shorten to seven lines maximum - this I am fine with. Remove all formatting - this breaks content such as lists, and I would like to avoid this. I have looked through the database settings but I was unable to find anything that affected this by default. Did I miss something in the options that would resolve this? If not, how can I change this to behave the way I would like it to. Is there any developer documentation available for review so that I can see the what these properties control and what their values are?
November 3, 20204 yr The truncate javascript widget removes formatting to get the number of lines right. You could change this to get a different effect: data-ipsTruncate-type='remove' to data-ipsTruncate-type='hide'
November 3, 20204 yr Author 29 minutes ago, bfarber said: The truncate javascript widget removes formatting to get the number of lines right. You could change this to get a different effect: data-ipsTruncate-type='remove' to data-ipsTruncate-type='hide' I have tried using both 'hide' and 'none' as values. After saving and refreshing, I can see the new value when inspecting the html, however there does not seem to be a change in behavior.
November 3, 20204 yr 5 hours ago, Foxtrek_64 said: {$record->truncated()|raw} I'm not that big in to Pages, but aren't you returning the truncated content here? So effectively you are truncating in HTML what is already truncated in the record. This should get the full content, which can then be truncated in HTML: {$record->_content|raw}
November 3, 20204 yr Author Solution Good catch, @Nathan Explosion. Setting the truncate type to hide and then getting the full content resolved the issue. Thanks!