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

Navbar includes redirects in generated HTML #197

Open
henrikrxn opened this issue Aug 7, 2021 · 2 comments
Open

Navbar includes redirects in generated HTML #197

henrikrxn opened this issue Aug 7, 2021 · 2 comments
Labels
⚠️ Bug Something isn't working as expected

Comments

@henrikrxn
Copy link

henrikrxn commented Aug 7, 2021

Just upgraded Static.Web to 1.0.0-beta.33 and used latest CleanBlog

A minor thing, but if using redirects via frontmatter then they are included in the HTML generated by _navbar.cshtml

Not visible (no text in link), but they are in the generated HTML.

I made an example
https://github.com/henrikrxn/StatiqWebQuickStartWithCleanBlogTheme
It uses Devlead's NuGet package for including themes via Uri, so it was easy for me to switch between CleanBlg versions

This branch in the same repo uses my own fork of CleanBlog to filter out redirects
https://github.com/henrikrxn/StatiqWebQuickStartWithCleanBlogTheme/tree/Using-CleanBlog-fork-excluding-Documents-with-RedirectTo

My solution was to add this additional code to the where clause for finding candidates to go into the navbar
... && !x.ContainsKey(Keys.RedirectTo) where x has type IDocument

Be happy to submit a PR to CleanBlog, but

  1. was not sure this is the best way and
  2. thought you might want to handle it in Statiq.Web or Statiq.Framework by e.g. adding an IsRedirect property or method somewhere
@daveaglick
Copy link
Member

Great find!

Your fix is good and I'm glad you were able to resolve it for your own use case, but yeah, I'd like to solve this holistically in Statiq Web. The problem is that there's a Redirects pipeline that's responsible for creating these redirect documents. Because the theme uses OutputPages which includes documents from all pipelines, the redirect documents get included.

Just thinking out loud here, but I'm thinking I'll resolve this in one of the following ways:

  • Metadata for documents that excludes them from the OutputPages collection.
  • Some sort of way to designate an entire pipeline as being excluded from OutputPages.

Then the Redirects pipeline in Statiq Web can use whatever upstream mechanism I implement to exclude these redirect files.

I'm going to chew on this for a day or two while I figure out the "right" way of handling this. Thanks!

@daveaglick
Copy link
Member

I'm also going to move this issue to Statiq Framework since that's where I'll end up resolving this for the most part.

@daveaglick daveaglick transferred this issue from statiqdev/CleanBlog Aug 13, 2021
@daveaglick daveaglick added the ⚠️ Bug Something isn't working as expected label Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ Bug Something isn't working as expected
Development

No branches or pull requests

2 participants