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

Configurable post url #288

Open
GringoDotDev opened this issue May 23, 2016 · 1 comment
Open

Configurable post url #288

GringoDotDev opened this issue May 23, 2016 · 1 comment

Comments

@GringoDotDev
Copy link

I've currently monkey patched my local monologue to default to post URLs like the following:

/2016-05-23/new-post-4

Would there be any interest in making this configurable as part of the gem? I'm thinking we could create a settable title_generator that would be invoked in Monologue::Post#generate_url if set.

e.g. you could do something like this:

config.title_generator = Proc.new do |post|
  return unless post.url.blank?
  date = post.published_at.class == ActiveSupport::TimeWithZone ? post.published_at.to_date : Date.today
  post.url = "#{date}/#{post.title.parameterize}"
end

If that sounds reasonable, let me know and I will open a PR.

@msevestre
Copy link
Collaborator

Absolutely. As long as the default behavior (e.g. Without any config proc)
remains the same as before, please go ahead.
Thanks a lot
On Mon, May 23, 2016 at 5:16 PM jseitel notifications@github.com wrote:

I've currently monkey patched my local monologue to default to post URLs
like the following:

/2016-05-23/new-post-4

Would there be any interest in making this configurable as part of the
gem? I'm thinking we could create a settable title_generator that would be
invoked in Monologue::Post#generate_url if set.

e.g. you could do something like this:

config.title_generator = Proc.new do |post|
return unless post.url.blank?
date = post.published_at.class == ActiveSupport::TimeWithZone ? post.published_at.to_date : Date.today
post.url = "#{date}/#{post.title.parameterize}"
end

If that sounds reasonable, let me know and I will open a PR.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#288

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