I'm getting a double heading 1 on my category pages eg on here: http://www.jrayson.co.uk/cms # Content Management Systems # Articles on Content Management Systems But I'm sure I used not to: http://nestacms.com/docs/creating-content/metadata-reference#articles_heading Any ideas? thanks, Jake PS when searching for: "category page" double headings nesta cms on Google, the top hit is "Fungal Infections RSS Page 27"!! -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
Why don't you post the code of your view dealing with that page? Preferably on https://gist.github.com/ -- Tommy Palmer @tommypalm http://tommyp.org On Tuesday, 21 February 2012 at 19:05, Jake Subs wrote: > I'm getting a double heading 1 on my category pages eg on here: > http://www.jrayson.co.uk/cms > > # Content Management Systems > # Articles on Content Management Systems > > But I'm sure I used not to: > http://nestacms.com/docs/creating-content/metadata-reference#articles_heading > > Any ideas? > > thanks, Jake > > PS when searching for: "category page" double headings nesta cms > on Google, the top hit is "Fungal Infections RSS Page 27"!! > > -- > [~] Jake Rayson > [w] www.jrayson.co.uk (http://www.jrayson.co.uk) > [e] subs@growdigital.org (mailto:subs@growdigital.org) > [t] @growdigital > >
On 21 February 2012 19:32, Tommy Palmer <hi@tommyp.org> wrote: > Why don't you post the code of your view dealing with that page? Preferably > on https://gist.github.com/ Doh. https://github.com/growdigital/jrayson/blob/master/themes/jaketheme/views/layout.haml Very plain vanilla, not sure why it would change? -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
I think I've found it. Your page.haml has this:
~ @page.to_html(self)
- unless @page.articles.empty?
%section.articles
%header
%h1= articles_heading
= article_summaries(@page.articles)
So Nesta runs @page.to_html, which creates the first <h1>. Then it hits
the unless block. @page.articles is not empty, so it creates the .articles
section, and prints the articles_heading - your second h1. This has
nothing to do with layout.haml; it's just coming in through the yield call
there.
Hope this helps!
Kevin
On Feb 21, 2012, at 3:48 PM, Jake Subs wrote:
> On 21 February 2012 19:32, Tommy Palmer <hi@tommyp.org> wrote:
>> Why don't you post the code of your view dealing with that page? Preferably
>> on https://gist.github.com/
>
> Doh.
>
https://github.com/growdigital/jrayson/blob/master/themes/jaketheme/views/layout.haml
>
> Very plain vanilla, not sure why it would change?
>
> --
> [~] Jake Rayson
> [w] www.jrayson.co.uk
> [e] subs@growdigital.org
> [t] @growdigital
On 21 February 2012 20:59, Kevin Zurawel <kzurawel@gmail.com> wrote: > So Nesta runs @page.to_html, which creates the first <h1>. Then it hits the > unless block. @page.articles is not empty, so it creates the .articles > section, and prints the articles_heading - your second h1 Excellent, thank you for this. I've just copied and pasted from the default theme page.haml, so I'm not really sure what's doing what. Will work out how to put the logic in to prevent the original <h1> being output, I'm sure it's straightforward! thanks, Jake -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
On 21 February 2012 20:59, Kevin Zurawel <kzurawel@gmail.com> wrote: > So Nesta runs @page.to_html, which creates the first <h1>. Then it hits the > unless block. @page.articles is not empty, so it creates the .articles > section, and prints the articles_heading - your second h1 I tested the site with the default template, and the same thing happens, so I'd like to put an `if ... else` condition in, so that the heading isn't displayed twice. Something along the lines of: - if @page.articles.!empty %section.articles %header %h1= articles_heading = article_summaries(@page.articles) - else ~ @page.to_html(self) But obviously that doesn't work as the syntax is wrong. Can anyone point me in the right syntactical direction? many thanks, Jake -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
On 27 Feb 2012, at 08:15, Jake Subs wrote:
> - if @page.articles.!empty
Try this:
- if ! @page.articles.empty?
On 27 February 2012 10:10, Graham Ashton <graham@effectif.com> wrote: >> - if @page.articles.!empty > Try this: > - if ! @page.articles.empty? Oh yes, it works a treat. Full blogging functionality acquired. Thank you :) -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
On 27 February 2012 19:19, Jake Subs <subs@growdigital.org> wrote: > Oh yes, it works a treat Just one last question: whereabouts is the Categories text “Articles on” defined? I've searched through the default nesta theme and can't find any references. I could define it individually but would be neater not to: http://nestacms.com/docs/creating-content/metadata-reference#articles_heading many thanks, Jake -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital
On 27 Feb 2012, at 19:26, Jake Subs wrote: > Just one last question: whereabouts is the Categories text “Articles > on” defined? I've searched through the default nesta theme and can't > find any references. I could define it individually but would be > neater not to: > http://nestacms.com/docs/creating-content/metadata-reference#articles_heading It's a helper method. In 0.9.11 it's in lib/nesta/app.rb, but I've moved the helpers to a separate file on the head of the master branch (see [1]): https://github.com/gma/nesta/blob/master/lib/nesta/helpers.rb#L78 If you're trying to replace the "Articles on" text with an alternative default of your own, your best bet is to redefine the articles_heading helper method. In your own app.rb, you could add this (inside the helpers block): def articles_heading @page.metadata('articles heading') || "My own prefix #{@page.heading}" end Graham [1] Random aside; I moved the helpers to their own module because it made the forthcoming nesta-rails gem easier to write... (nesta-rails is Nesta, running natively in a Rails app, sharing layout, styles, javascript etc. with the rest of your app).
On 27 February 2012 22:49, Graham Ashton <graham@effectif.com> wrote: > If you're trying to replace the "Articles on" text with an alternative default of your own, your best bet is to redefine the articles_heading helper method. In your own app.rb, you could add this (inside the helpers block) "Sweet", as the kidz say. Everything looking cooshti now, thanks. -- [~] Jake Rayson [w] www.jrayson.co.uk [e] subs@growdigital.org [t] @growdigital