Summary
Finds the first occurrence of a specified HTML comment or element and stores it's contents as metadata.
- Assembly
- Wyam
.Html .dll - Namespace
- Wyam
.Html - Interfaces
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Wyam.Common.Modules/IModule"
Type["Excerpt"]
class Type type-node
Syntax
public class Excerpt : IModule
Remarks
This module is useful for situations like displaying the first paragraph of your most recent
blog posts or generating RSS and Atom feeds.
This module looks for the first occurrence of an excerpt separator (default of
more
or excerpt
)
contained within an HTML comment (<!--more-->
). If a separator comment isn't found, the module
will fallback to looking for the first occurrence of a specific HTML element (p
paragraph elements by default)
and will use the outer HTML content. In both cases, the excerpt is placed in metadata with a key of Excerpt
.
The content of the original input document is left unchanged.
Constructors
Name | Summary |
---|---|
Excerpt |
Creates the module with the default query selector of p .
|
Excerpt |
Specifies an alternate query selector for the content. |
Excerpt |
Specifies alternate separators to be used in an HTML comment.
Setting this to null will disable looking for separators
and rely only on the query selector.
|
Methods
Name | Value | Summary |
---|---|---|
Execute |
IEnumerable |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
|
WithMetadataKey |
Excerpt |
Allows you to specify an alternate metadata key.
|
WithOuterHtml |
Excerpt |
Controls whether the inner HTML (not including the containing element's HTML) or
outer HTML (including the containing element's HTML) of the first result from
the query selector is added to metadata. The default is true, which gets the outer
HTML content. This setting has no effect if a separator comment is found.
|
WithQuerySelector |
Excerpt |
Allows you to specify an alternate query selector. If a separator
comment was found then the query selector will be used to determine which
elements prior to the separator the excerpt should be taken from.
|
WithSeparators |
Excerpt |
Specifies alternate separators to be used in an HTML comment.
Setting this to
null will disable looking for separators
and rely only on the query selector.
|