Allows you to create excerpts of your entries by removing HTML tags and limiting the content by character count, word count or a specific marker you insert into your content.
nathanpitman/Hacksaw-for-ExpressionEngine
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Hacksaw takes your entry's content and whittles it down to a more manageable size. It strips the HTML and limits the excerpts by character count, word count or cutoff marker. To use Hacksaw simple wrap the content you want to truncate with the exp:eehive_hacksaw tag, like this: {exp:eehive_hacksaw} {your_content} {/exp:eehive_hacksaw} There are several parameters you can use to control how the content is truncated. These options are: chars = "" // Limit by number of characters words = "" // Limit by number of words cutoff = "" // Limit by a specific cutoff string append = "" // String to append to the end of the excerpt allow = "" // HTML tags you want to allow. Ex allow="<b><a>" For example, if you want to limit your excerpt to 100 words you would do this: {exp:eehive_hacksaw words="100"} {your_content} {/exp:eehive_hacksaw} By default Hacksaw will strip all HTML from your excerpt. If you would like to keep some basic HTML you can use the 'allow' parameter to keep specific HTML tags. For example, let's say you want to keep <p> and <b> tags: {exp:eehive_hacksaw words="100" allow="<p><b>"} {your_content} {/exp:eehive_hacksaw} This would strip all HTML except paragraph (<p>) and bold (<b>) tags. Another way to limit content is by a cutoff string. This is similar to the way Wordpress's "more" feature works. In your content you could add a specific string to indicate the spot you want the excerpt to stop. Let's say you use "<!-- END -->". To cut the excerpt off at this location you would do this: {exp:eehive_hacksaw cutoff="<!-- END -->"} {your_content} {/exp:eehive_hacksaw} The 'cutoff' parameter can be coupled with the 'words' parameter in case you forget to add the cutoff string to some of your entries. This way the excerpt will be truncated at the cutoff string, OR after X words. You can add any string at the end of the excerpt using the 'append' parameter, like this: {exp:eehive_hacksaw words="100" append="..."} {your_content} {/exp:eehive_hacksaw} This would append "..." to the end of the excerpt. For complete documentation go to http://www.ee-hive.com/hacksaw
About
Allows you to create excerpts of your entries by removing HTML tags and limiting the content by character count, word count or a specific marker you insert into your content.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published