Finds the first occurrence of a specified HTML comment or element and stores it's contents as metadata.
- Namespace
- Statiq
.Core - Interfaces
- Base Types
-
- object
- Module
- ParallelModule
graph BT
Type-->Base0["ParallelModule"]
click Base0 "/api/Statiq.Common/ParallelModule"
Base0-->Base1["Module"]
click Base1 "/api/Statiq.Common/Module"
Base1-->Base2["object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Statiq.Common/IModule"
Type-.->Interface1["IParallelModule"]
click Interface1 "/api/Statiq.Common/IParallelModule"
Type["GenerateExcerpt"]
class Type type-node
Syntax
public class GenerateExcerpt : ParallelModule, IModule, IParallelModule
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 |
---|---|
GenerateExcerpt |
Creates the module with the default query selector of p .
|
GenerateExcerpt |
Specifies an alternate query selector for the content. |
GenerateExcerpt |
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.
|
Properties
Name | Property Type | Summary |
---|---|---|
Parallel | bool |
Indicates whether documents will be
processed by this module in parallel.
Inherited from ParallelModule
|
Methods
Name | Return Value | Summary |
---|---|---|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExecuteAsync |
Task |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
Inherited from ParallelModule
|
ExecuteInputAsync |
Task |
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
WithMetadataKey |
GenerateExcerpt |
Allows you to specify an alternate metadata key.
|
WithOuterHtml |
GenerateExcerpt |
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 |
GenerateExcerpt |
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 |
GenerateExcerpt |
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.
|