guyht / Glog

NodeJS and Git backed blogging engine
MIT License
52 stars 10 forks source link

Optionally omit article from home page #18

Closed wlaurance closed 11 years ago

wlaurance commented 11 years ago

Add "show_on_home_page":false to article header. The default is true for the article to appear on the home page.

guyht commented 11 years ago

Hi Laurance,

Thanks for this, will merge and prepare a release this weekend. I think going forward we should look at having a better system to pass variables from the articles header to the template player. Maybe define a 'user_header' variable that is passed directly to the template.

The article would look like this:

{
"title" : "My App Store Experience",
"date" : "2012-03-07",
"author" : "Guy",
    "user_variables" {
          "show_on_home_page" : false,
          "custom_template_variable" : "xyz"
    }
}

This would allow any template to accept custom variables without having to make changes to the Glog engine.

Let me know your thoughts

G

wlaurance commented 11 years ago

Yes, this sounds like the best direction for article by article configuration.

guyht commented 11 years ago

Laurance, can you fix the test cases for this? I would like to merge it.

Thanks

wlaurance commented 11 years ago

If you merge https://github.com/guyht/Guido/pull/2/commits then the test cases all pass. Is this what you mean or would you like something different?

guyht commented 11 years ago

I am getting the following error when running the tests:

1) default to show on home page

✖ 1 of 7 tests failed:

1) Glog default to show on home page:

assertionError: true == false
  at /vol/git_src/Glog/test/glog_tests.js:92:32
  at /vol/git_src/Glog/lib/glog.js:336:9
  at [object Object].<anonymous> (fs.js:115:5)
  at [object Object].emit (events.js:64:17)
  at afterRead (fs.js:1112:12)
  at Object.wrapper [as oncomplete] (fs.js:254:17)
wlaurance commented 11 years ago

Alright, I am able to get this error to occur some times but not all. I'm assuming you are attempting to merge this into the "config" branch?

wlaurance commented 11 years ago

https://gist.github.com/3932972

Looks like the articles are being called back in a different order which is to be expected with callbacks. Perhaps I should add some sorting to the lists by date so they come back in a guarantee order.

guyht commented 11 years ago

Ah! Yes that makes sense. V8 does not honour the order or objects. The ordering is probably best put in the test suite, as we already order the articles in glog, but just later on in the code.

On 22 October 2012 11:04, Will Laurance notifications@github.com wrote:

https://gist.github.com/3932972

Looks like the articles are being called back in a different order which is to be expected with callbacks. Perhaps I should add some sorting to the lists by date so they come back in a guarantee order.

— Reply to this email directly or view it on GitHubhttps://github.com/guyht/Glog/pull/18#issuecomment-9674109.

wlaurance commented 11 years ago

the ci builds are going to fail until npmjs.org comes back to life.

guyht commented 11 years ago

Ye, there is a major AWS outage which has taken down Reddit, Heroku, AppFog... just to name a few. According to Amazon "Minor performance issues"

http://news.ycombinator.com/item?id=4684384

On 22 October 2012 13:53, Will Laurance notifications@github.com wrote:

the ci builds are going to fail until npmjs.org comes back to life.

— Reply to this email directly or view it on GitHubhttps://github.com/guyht/Glog/pull/18#issuecomment-9680191.

wlaurance commented 11 years ago

I was using node 0.8.12 to test and the objects would return in the order I desired. However using node 0.6 the two articles with the same date would be transposed.

gausie commented 11 years ago

What is the status of the pull request now?

wlaurance commented 11 years ago

With the latest commit, adding ""show_on_home_page":false" behaves like it should. However it is not in master as of now.

guyht commented 11 years ago

My bad for not merging this. Between airports at the moment but will sort it out this week.

Guy Halford-Thompson Sent from my iPhone

On Sunday, 6 January 2013 at 12:35, Will Laurance wrote:

With the latest commit, adding ""show_on_home_page":false" behaves like it should. However it is not in master as of now.

— Reply to this email directly or view it on GitHub (https://github.com/guyht/Glog/pull/18#issuecomment-11933835).