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
johanvergeer opened this issue Jun 18, 2019 · 1 comment
Open

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

johanvergeer opened this issue Jun 18, 2019 · 1 comment

Comments

@johanvergeer
Copy link
Contributor

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)
);
@daveaglick
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants