Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example on how to add a module to RenderPages pipeline #7

Open
savornicesei opened this issue Jun 3, 2021 · 1 comment
Open

Example on how to add a module to RenderPages pipeline #7

savornicesei opened this issue Jun 3, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@savornicesei
Copy link
Contributor

Issue by johanvergeer
Tuesday Jun 18, 2019 at 20:00 GMT
Originally opened as Wyamio/Wyam#7


Could you show a full example on how to add a module to the RenderBlogPosts pipeline, without breaking the existing pipeline. The reason I'm asking is because I want to insert the SearchIndex module. I got the search functionality to work, but now the layout is messed up.

My guess is that it should be something like this, but that doesn't work. I would prefer to have a generic example, which could also be included in the documentation.

int renderBlogPostsIndex = Pipelines.IndexOf(Blog.RenderBlogPosts);
Pipelines.Remove(Blog.RenderBlogPosts);

Pipelines.Insert(
        renderBlogPostsIndex,
        Blog.RenderBlogPosts,
	ReadFiles("posts/*.md"),
	FrontMatter(Yaml()),
	Meta("SearchIndexItem", 
		new SearchIndexItem("/" + @doc.String(Keys.RelativeFilePathBase), @doc.String("Title"), @doc.Content) 
			{ 
				Description = @doc.String("Description"), 
				Tags = @doc.String("Tags") 
			}
	),
	Markdown(),
	Excerpt(),
	Razor(),
	WriteFiles(".html2")
);

Pipelines.Add("SearchIndex",
	Documents(Blog.RenderBlogPosts),
	SearchIndex((FilePath)"stopwords.txt"),
	WriteFiles((doc,ctx) => string.IsNullOrEmpty(doc.Content) ? null : "searchindex.js").UseWriteMetadata(false)
);
@savornicesei
Copy link
Contributor Author

Comment by daveaglick
Saturday Feb 29, 2020 at 21:11 GMT


FYI - the original Wyam project is being moved to statiqdev to continue work there as Statiq Web (the successor to Wyam and the Wyam blog recipe). Since this issue relates specifically to Wyam, I've transfered it to a new replacement project for legacy Wyam issues.

(This is an automated message)

@savornicesei savornicesei added the documentation Improvements or additions to documentation label Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant