Replies: 1 comment
-
Assuming you mean something like: I think you could modify the frontmatter in a https://www.bridgetownrb.com/docs/plugins/generators Something like this: # plugins/builders/permalink_modifier.rb
class Builders::PermalinkModifier < SiteBuilder
def build
generator do
# Rename "thoughts" to whatever your collection name is.
resources = site.collections.thoughts.resources
resources.each do |resource|
thought_name = File.basename(resource.relative_path.basename, ".md").to_s
stripped_thought = thought_name.split(/^\d+-/).join("")
# Modify the frontmatter data to have the right permalink
resource.data.merge!({
permalink: "/thoughts/#{stripped_thought}"
})
end
end
end
end Perhaps a build hook may make more sense. https://www.bridgetownrb.com/docs/plugins/hooks Happy to defer to @jaredcwhite here if this isn't the right way! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Is there a way to strip the leading number from the filename when publishing so I could keep thoughts in order? I am using the same system you have to documentation site. There is
order:
in frontmatter, is there a way to keep the files sorted the same way? Somepermalink
magic?Beta Was this translation helpful? Give feedback.
All reactions