Skip to main content
added 146 characters in body
Source Link

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

{{ entry.body|striptags|slice(0,100)|default('Read more') }}...

slice will simply output the first 100 characters (starting at 0 the first character), including spaces into the template. striptags ensures that no html tags will be output.

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

{{ entry.body|striptags|slice(0,100)|default('Read more') }}...

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

{{ entry.body|striptags|slice(0,100)|default('Read more') }}...

slice will simply output the first 100 characters (starting at 0 the first character), including spaces into the template. striptags ensures that no html tags will be output.

deleted 7 characters in body
Source Link

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

<p>{{ entry.body|striptags|slice(0,100)|default('Read more') }}...</p>

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

<p>{{ entry.body|striptags|slice(0,100)|default('Read more') }}...</p>

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

{{ entry.body|striptags|slice(0,100)|default('Read more') }}...
Source Link

No need for a plugin, just use twig's slice filter, combined with the striptags filter.

I've thrown in the default filter for good measure, in case the body is empty for some reason.

<p>{{ entry.body|striptags|slice(0,100)|default('Read more') }}...</p>