UX: Make header/footer HTML consistent for crawler and noscript
These were originally very similar, but have diverged over time. This makes it very difficult to manage styling. This commit moves the noscript header and footer into partials so they can be reused in both the crawler view and the `<noscript>` view. It also makes browser-update render the noscript content **instead of** the `<section id='main'>`, rather than adding adding the noscript inside the `<section>`. This provides better parity with the server-rendered crawler view.
This commit is contained in:
parent
230e220710
commit
683b172104
|
@ -37,7 +37,7 @@
|
|||
result += noscriptElements[i].childNodes[j].nodeValue;
|
||||
}
|
||||
|
||||
mainElement.innerHTML = result;
|
||||
mainElement.outerHTML = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<footer class="container wrap">
|
||||
<nav class='crawler-nav'>
|
||||
<ul>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/" %>' itemprop="url"><%= t 'home_title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/categories" %>' itemprop="url"><%= t 'js.filters.categories.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/tos" %>' itemprop="url"><%= t 'tos_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/privacy" %>' itemprop="url"><%= t 'privacy_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<p class='powered-by-link'><%= t 'powered_by_html' %></p>
|
||||
</footer>
|
|
@ -0,0 +1,5 @@
|
|||
<header>
|
||||
<a href="<%= path "/" %>">
|
||||
<h1><%=SiteSetting.title%></h1>
|
||||
</a>
|
||||
</header>
|
|
@ -73,25 +73,15 @@
|
|||
|
||||
<%= render_google_tag_manager_body_code %>
|
||||
<noscript data-path="<%= request.env['PATH_INFO'] %>">
|
||||
<%= render partial: 'header' %>
|
||||
<%= render partial: "layouts/noscript_header" %>
|
||||
|
||||
<div id="main-outlet" class="wrap" role="main">
|
||||
<!-- preload-content: -->
|
||||
<%= yield %>
|
||||
<!-- :preload-content -->
|
||||
<footer class="noscript-footer-nav">
|
||||
<nav itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<a href='<%= path "/" %>'><%= t 'home_title' %></a>
|
||||
<%= link_to t('js.filters.categories.title'), path("/categories") %>
|
||||
<%= link_to t('guidelines_topic.title'), path("/guidelines") %>
|
||||
<%= link_to t('tos_topic.title'), path("/tos") %>
|
||||
<%= link_to t('privacy_topic.title'), path("/privacy") %>
|
||||
</nav>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<footer id='noscript-footer'>
|
||||
<p><%= t 'powered_by_html' %></p>
|
||||
</footer>
|
||||
<%= render partial: "layouts/noscript_footer" %>
|
||||
</noscript>
|
||||
|
||||
<%- unless customization_disabled? %>
|
||||
|
|
|
@ -16,46 +16,11 @@
|
|||
</head>
|
||||
<body class="crawler">
|
||||
<%= theme_lookup("header") %>
|
||||
<header>
|
||||
<a href="<%= path "/" %>">
|
||||
<h1><%=SiteSetting.title%></h1>
|
||||
</a>
|
||||
</header>
|
||||
<div id="main-outlet" class="wrap">
|
||||
<%= render partial: "layouts/noscript_header" %>
|
||||
<div id="main-outlet" class="wrap" role="main">
|
||||
<%= yield %>
|
||||
</div>
|
||||
<footer class="container wrap">
|
||||
<nav class='crawler-nav'>
|
||||
<ul>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/" %>' itemprop="url"><%= t 'home_title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/categories" %>' itemprop="url"><%= t 'js.filters.categories.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/tos" %>' itemprop="url"><%= t 'tos_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
|
||||
<span itemprop='name'>
|
||||
<a href='<%= path "/privacy" %>' itemprop="url"><%= t 'privacy_topic.title' %> </a>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<p class='powered-by-link'><%= t 'powered_by_html' %></p>
|
||||
</footer>
|
||||
<%= render partial: "layouts/noscript_footer" %>
|
||||
<%= theme_lookup("footer") %>
|
||||
<%= theme_lookup("body_tag") %>
|
||||
<% if show_browser_update? %>
|
||||
|
|
Loading…
Reference in New Issue