Rescue nil for sitemap

This commit is contained in:
saurabhbhatia 2013-11-25 12:53:57 +08:00
parent cb7b7c4edf
commit 242878a09f
1 changed files with 2 additions and 2 deletions

View File

@ -31,10 +31,10 @@ class FrontController < ApplicationController
def show_site_sub_menu
@page = Page.find(:all, :conditions => {:name => /sitemap/i})
@name = @page.first.name
@name = @page.first.name if @page.first.present?
@url = "/#{@name}"
if !@site.sitemap_menu_in_header
if (!@site.sitemap_menu_in_header && @page.first.present?)
render :text => (@site.sub_menu + "<a href='#{@url}'>Sitemap</a>")
else
render :text => @site.sub_menu