Re: [nesta] menu weirdness
- From:
- Jeff Schoolcraft
- Date:
- 2012-04-08 @ 16:26
I'm trying to wrap my head around menus, I understand your point about
every page needing a heading (even though I had a heading in a layout
set programmatically by title).
I went back through, killed everything and started with just pages and
menu: https://bitbucket.org/jschoolcraft/agilitum.com
I'm still not getting what I expect.
I even did some poor man debugging in lib/models to see what was going
on with menu:
MENU:
[]
MENU: Processing: /
MENU: current_depth: 0, :depth => 0
calling: sub_menu_for_depth(menu, 0) << page
calling: append_menu_item(menu, file, 0)
MENU:
[#<Nesta::Page:0x00000101d35520 @filename="content/pages/index.haml",
@format=:haml, @metadata={}, @markup="- display_menu(@menu_items)\n\n-
display_menu(Nesta::Menu.full_menu)\n\n%h1 Home\n\n%section.articles=
article_summaries(latest_articles)\n", @mtime=2012-04-08 11:38:09 -0400>]
MENU: Processing: services
MENU: current_depth: 0, :depth => 0
calling: sub_menu_for_depth(menu, 0) << page
calling: append_menu_item(menu, file, 0)
MENU:
[#<Nesta::Page:0x00000101d35520 @filename="content/pages/index.haml",
@format=:haml, @metadata={}, @markup="- display_menu(@menu_items)\n\n-
display_menu(Nesta::Menu.full_menu)\n\n%h1 Home\n\n%section.articles=
article_summaries(latest_articles)\n", @mtime=2012-04-08 11:38:09
-0400>, #<Nesta::Page:0x00000101d236e0
@filename="content/pages/services/index.haml", @format=:haml,
@metadata={}, @markup="%h1 Services\n\n%h2 Foo\n\n%h2 Bar\n",
@mtime=2012-04-08 09:09:39 -0400>]
MENU: Processing: web-application-development
(it dies here, Page is nil)
I stepped through all the File.load code, and it can find
web-application-development and looks like it should be able to load it
if it isn't cached already.
Can you clue me in on what I'm doing wrong? Every page that's in the
menu exists, every page has a heading as the first line of body content.
> Graham Ashton <mailto:graham@effectif.com>
> April 2, 2012 7:16 AM
>
> Nesta parses the first line of the body of your document, expecting it
> to be a heading. It extracts the text and uses it in things like menus
> to link to the page.
>
> There's a discussion on GitHub issue 104 about this, and a plan to add
> new "Link text" metadata so that this becomes less magic and a bit
> more obvious.
> Jeff Schoolcraft <mailto:jeff@thequeue.net>
> April 2, 2012 7:14 AM
> I'm using the title to set the h1 programmatically in the layout.
>
> For example:
>
https://bitbucket.org/jschoolcraft/agilitum.com/src/c67644cfadc5/views/full_width.haml#cl-5
>
> or are we not talking about h1's and talking about metadata
>
> Graham Ashton wrote:
> Graham Ashton <mailto:graham@effectif.com>
> April 2, 2012 5:55 AM
>
> The menu item headings weren't showing up because the pages didn't
> have any headings. The title metadata doesn't set the page heading,
> just the title tag.
>
> Do I need to make more of the statement "every web page should have a
> main heading" on this page?
>
> http://nestacms.com/docs/creating-content/pages
>
> I notice it doesn't say what happens if you don't have one...
> Jeff Schoolcraft <mailto:jeff@thequeue.net>
> April 1, 2012 11:17 AM
> https://bitbucket.org/jschoolcraft/agilitum.com/
>
> Graham Ashton wrote:
> Graham Ashton <mailto:graham@effectif.com>
> April 1, 2012 11:12 AM
>
> The third page referenced by your menu doesn't exist. Search this page
> for the word "relative"; it's an important sentence:
>
> http://nestacms.com/docs/creating-content/menus
>
> In other words, sub menu items need specifying with their full paths.
>
> Admittedly the example menu doesn't illustrate this well, as the paths
> in the example file don't look like they're relative to /.
>
> I can't answer the other questions without pointing a debugger at it.
> Repo URL?
Re: [nesta] menu weirdness
- From:
- Max Sadrieh
- Date:
- 2012-04-09 @ 21:19
Hi Jeff,
Would this help:
diff --git a/content/menu.txt b/content/menu.txt
index 9c5b8b3..b88dc13 100644
--- a/content/menu.txt
+++ b/content/menu.txt
@@ -1,9 +1,9 @@
/
services
- web-application-development
- mobile-application-development
- project-rescue
- training
+ services/web-application-development
+ services/mobile-application-development
+ services/project-rescue
+ services/training
products
company
- how-we-work
+ company/how-we-work
You're final menu.txt is therefore https://gist.github.com/2346605
Your problem was that the pages (for example project-rescue) are in the
folders (for example services/) and the menu operates from
$NESTA_ROOT/content/
Cheers.
-Max Sadrieh