gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 121 forks source link

Add default_read_more configuration key #117

Closed gadomski closed 11 years ago

gadomski commented 11 years ago

This value allows the user to change the default 'Continue reading' string that is used when the Read more metadata is not set.

gma commented 11 years ago

Cheers, a good idea. Do you fancy renaming the config setting to "read_more" and updating this PR?

gadomski commented 11 years ago

No problem, config key changed.

gma commented 11 years ago

Cheers. I was just looking at merging this, and ran the tests. They're failing because there's no default value for read_more in existing config files. I'm glad they're failing, or I wouldn't have noticed that this'll break existing installations that haven't got read_more in their config files.

We're going to need a Config.read_more class method, instead of just adding it to the settings list.

I think we'll need to:

  1. Remove it from settings.
  2. Write Config.read_more that uses from_environment and from_yaml, and falls back to "Continue reading" if read_more isn't set in either location.

I don't think we'll need a unit test for it if the implementation is as simple as I envisage, as it'll just need to pick from one of three values, using methods that are already well tested.

If you could replace all the commits on this branch down to 1 commit, that'd be awesome. Ideally it'll all appear on the master branch as a single commit.

gadomski commented 11 years ago

Config.read_more class method added, branch squashed to one commit, and tests passing. Apologies for not testing before creating the pull request, poor form from this guy...

I kept a commented-out version of the read_more config key in the settings file. Would you like to keep it there, or add it to the docs instead (or in addition)?

gma commented 11 years ago

Nice one.

I think jt should stay in the config file, commented out, and also go in the docs. They're the "reference" docs really.

gadomski commented 11 years ago

Alright, then I think this pull request is good to go from my side. I've opened gma/nestacms.com#25 for the documentation update.

gma commented 11 years ago

Merged, cheers.

nurettin commented 10 years ago

I'm using the latest gem (0.9.13) and somehow it has no effect in config/config.yml

read_more: "Read More"

I still get "Continue reading" rendered in pages.

oh btw

@settings = %w[
  title subtitle theme disqus_short_name cache content google_analytics_code
]

apparently the patch didn't get into that version, so I will just use the git version.