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

Linting only runs on two files! #253

Open
chriswilty opened this issue Oct 14, 2024 · 5 comments
Open

Linting only runs on two files! #253

chriswilty opened this issue Oct 14, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@chriswilty
Copy link
Member

Whoops:

image

Turns out we are linting just two posts, because the glob pattern in lintPosts.js is this:
"*/_posts/**/*.{md,html}"

The pattern should be
"_posts/**/*.{md,markdown,html}"

And with that, predictably, we see a colossal amount of errors! However, all is not lost:

  • most of these are down to "more than one category" chosen for a post, which is not allowed (Why is that?), though the vast majority of these seem to have the author name as an extra category
  • two are "does not have a recognised category" due to the author using "AI" instead of "Artificial Intelligence"
  • the remaining ones (25) appear to be due to another piece of logic expecting posts to be within author subdirectories, and once that is corrected, these all become "summary is less than 130 characters". Is 130 characters a meaningful limit? It seems relatively common that authors have less than this.
@chriswilty chriswilty added the bug Something isn't working label Oct 14, 2024
@chriswilty
Copy link
Member Author

If we reinstate linting, I believe we can drop the restiction on having a single category. Our current rendering logic chooses the first category as the "primary" for the post header, but the post is actually visible under all given categories, which can make it easier to find when searching for a post from way back, so I believe that is a good thing.

We will still need at least one category, and we should also check that all given categories are valid names from _data/categories.yml.

We should run this as a github workflow.

@chriswilty
Copy link
Member Author

Note that an alternative to multiple categories would be #197 to provide a keyword search.

@ColinEberhardt
Copy link
Contributor

ColinEberhardt commented Oct 16, 2024

I have no objection to posts being in more than one category, as long as this is done sparingly! otherwise, this just becomes a form of tagging, as per the issue referenced above!

@chriswilty
Copy link
Member Author

I have no objection to posts being in more than one category, as long as this is done sparingly! otherwise, this just becomes a form of tagging, as per the issue referenced above!

Very true! We could of course set a limit on number of categories, and fail the build if folks are abusing the system. But just occasionally, it's difficult to choose between two different categories.

@dogle-scottlogic
Copy link
Contributor

Opened a PR to look at this - it's a bit big 😬
#274
Couple of bits to note:

  • I've addressed the 130 summary limit thing by making it a warning rather than a fail.
  • I've set the max categories a post can have to 3
  • I've removed all instances of author from the categories section however I rather suspect that siteleaf is doing this and I'm not very clear on how that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants