[hibernate-dev] Hibernate.org layouts

Hardy Ferentschik hardy at hibernate.org
Thu Aug 20 05:13:27 EDT 2015


Hi,

I am not a great expert on the templating side either, but I can tell you how it
is put together atm.

The left hand menu items for the different projects (About, Downloads, Documentation, etc)
are actually generated from the site config. 

If you look into _config/site.yml, you see that each project defines a menu section which
is in itself split between intern and extern. The menu items specified in site.yml are
then displayed depending on the chosen project.

The place where this is happening is _layouts/project/project-frame.html.haml:

{code}
      %ul.nav.nav-list
        -# removes index.html and then replace download.html to download/
        - current_path = page.output_path.sub(/index\.html$/, "").sub(/\.html$/,"/")
        - project_description.menu.intern.each do |menu|
          -# active if path is a subpath of the menu item. The project home has to be treated differently as every path is a subpath of home
          - active = (menu.href == "/#{page.project}/" && menu.href == current_path) || (menu.href != "/#{page.project}/" && current_path.start_with?(menu.href))
          %li{:class => "#{(active ? "active" : "")}"}
            %a{:href => "#{relative("#{menu.href}")}"}
              %i{:class => "#{menu.css_class} menu-icon"}
              #{menu.name}
        %li.divider
        - project_description.menu.extern.each do |menu|
          %li
            %a{:href => "#{menu.href}"}
              %i{:class => "#{menu.css_class} menu-icon"}
              #{menu.name}
{code}

project_description.menu.intern.each will iterate over the intern links for a given project whereas 
project_description.menu.extern.each iterates the external links.

So far so good. Depending on how dynamic you want all this to work you have multiple options.

1) Work with the current approach and just define your different documentation links. If you work
   with the current structure you would get multiple Downloads links pointing to the different 
   doc versions. This is the simplest approach and does not require any template change at all
2) Create a sub hash orm:menu:intern:documentation:versions (just extending the nested structure
   we already have. YAML will automatically create the nested hashes out of this.) In the template 
   you would then need to handle the ORM case a bit different (eg by checking whether the current
   project is ORM). This way I could envision a single Download link which would point to the 
   current docs together with a little expander icon next to it which when clicked makes the
   other documentation links visible by expanding some sort of div. I think this would be visually 
   much more appealing. Obviously you need to deal with template changes as well as HTML + CSS changes 
   for getting the drop out menu right.
3) In the template check whether your current items is the ORM Download and if so, do whatever you want.
   This bypasses site.yml completely.

Personally I think 1) is a great way to get started verify the new approach and its navigation. Once all is 
working as it should I would look into 2) since I think it would be visually much more appealing. Maybe
Davide could help with the CSS/HTML part. I am pretty bad with this.

Anyways, hope this points you into the right direction.

--Hardy
 




On Wed, Aug 19, 2015 at 10:52:32PM +0000, Steve Ebersole wrote:
> In regards to WEBSITE-382
> <https://hibernate.atlassian.net/browse/WEBSITE-382>[1], I would love to
> get the "list" of version family specific doc page links into the left nav
> ideally as another section there.  Anyone able to give me some pointers how
> to hook into the left-hand nav links are managed?
> 
> I see 'bothcol.html.haml' defines 'leftcol.html.haml' and
> 'rightcol.html.haml' are defined.  But I have no idea if that is the right
> place.  I have never even seen a right-hand column in use in the website.
> And I have not found any specific 'leftcol.html.haml' or
> 'rightcol.html.haml' files.
> 
> [1] https://hibernate.atlassian.net/browse/WEBSITE-382
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 496 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20150820/25cdc9f8/attachment-0001.bin 


More information about the hibernate-dev mailing list