-
Notifications
You must be signed in to change notification settings - Fork 315
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
Bug: user-centered design tag index not showing all posts #1947
Comments
I believe this could be fixed by adding a hyphen to the one post that is tagged |
One concern is whether "fixing" this for our purposes, then contributing that back to the plugin project, would impose our style choices on other users, which might not be totally appropriate. Next steps:
|
Here is the related issue I opened with the Jekyl Archives project back in the day jekyll/jekyll-archives#43 |
Ok, so I did a bit more research on this today. Assuming that we want to monkey patch this instead of messing with Jekyll Archives itself (probably less likely to spawn new bugs), there are two major things we need to do.
def clean_tags(tags)
cleaned_tags = []
tags.each do |tag|
cleaned_tags << tag.gsub(/[^0-9A-Za-z]/, ' ').squeeze
end
cleaned_tags
end
Jekyll::Hooks.register :posts, :pre_render do |post|
tags = post.data['tags'] || []
if tags.any?
post.data['tags'] = clean_tags(post.data['tags'])
end
end
There doesn't seem to be much documentation on this on stackoverflow, github, or blogs (people don't mess around with Jekyll core monkey patching I guess), so the most useful documentation has been the Jekyll Archives rubydocs API and the Jekyll Hooks docs This might feel like overkill for a small bit of tag consolidation, but it has been really helpful to understand how Jekyll hooks works and how the Jekyll Archives core operates. |
The tag list shows 27 posts with the tag
user-centered design
But the page only shows 1 post.
The text was updated successfully, but these errors were encountered: