mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: render About page for web crawlers
This commit is contained in:
parent
d7bc340310
commit
df413737d2
3 changed files with 113 additions and 3 deletions
|
@ -1,12 +1,22 @@
|
|||
require_dependency 'rate_limiter'
|
||||
|
||||
class AboutController < ApplicationController
|
||||
skip_before_filter :check_xhr, only: [:show]
|
||||
skip_before_filter :check_xhr, only: [:index]
|
||||
before_filter :ensure_logged_in, only: [:live_post_counts]
|
||||
|
||||
def index
|
||||
@about = About.new
|
||||
render_serialized(@about, AboutSerializer)
|
||||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
# @list = list
|
||||
# store_preloaded(list.preload_key, MultiJson.dump(TopicListSerializer.new(list, scope: guardian)))
|
||||
render :index
|
||||
end
|
||||
format.json do
|
||||
render_serialized(@about, AboutSerializer)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def live_post_counts
|
||||
|
|
100
app/views/about/index.html.erb
Normal file
100
app/views/about/index.html.erb
Normal file
|
@ -0,0 +1,100 @@
|
|||
<% content_for :title do %><%=t "about" %><% end %>
|
||||
|
||||
<section itemscope itemtype="https://schema.org/AboutPage">
|
||||
<h1 itemprop="name">
|
||||
<%=t "js.about.title", {title: @about.title} %>
|
||||
</h1>
|
||||
|
||||
<div itemprop="text">
|
||||
<%= @about.description %>
|
||||
</div>
|
||||
|
||||
<h2><%=t "js.about.our_admins" %></h2>
|
||||
|
||||
<div class='admins-list' itemscope itemtype='http://schema.org/ItemList'>
|
||||
<% @about.admins.each do |user| %>
|
||||
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
||||
<meta itemprop='url' content='<%= user_path(user) %>'>
|
||||
<a href='<%= user_path(user) %>' itemprop='item'>
|
||||
<span itemprop='image'>
|
||||
<img width="45" height="45" class="avatar" src="<%= user.small_avatar_url %>">
|
||||
</span>
|
||||
<span itemprop='name'>
|
||||
<%= user.username %>
|
||||
<% if user.name.present? %>
|
||||
- <%= user.name %>
|
||||
<% end %>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @about.moderators.count > 0 %>
|
||||
<h2><%=t "js.about.our_moderators" %></h2>
|
||||
<div class='moderators-list' itemscope itemtype='http://schema.org/ItemList'>
|
||||
<% @about.moderators.each do |user| %>
|
||||
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
||||
<meta itemprop='url' content='<%= user_path(user) %>'>
|
||||
<a href='<%= user_path(user) %>' itemprop='item'>
|
||||
<span itemprop='image'>
|
||||
<img width="45" height="45" class="avatar" src="<%= user.small_avatar_url %>">
|
||||
</span>
|
||||
<span itemprop='name'>
|
||||
<%= user.username %>
|
||||
<% if user.name.present? %>
|
||||
- <%= user.name %>
|
||||
<% end %>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<section class='about stats'>
|
||||
<h2><%=t 'js.about.stats' %></h2>
|
||||
|
||||
<table class='table'>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><%=t 'js.about.stat.all_time' %></th>
|
||||
<th><%=t 'js.about.stat.last_7_days' %></th>
|
||||
<th><%=t 'js.about.stat.last_30_days' %></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='title'><%=t 'js.about.topic_count' %></td>
|
||||
<td><%= @about.stats[:topic_count] %></td>
|
||||
<td><%= @about.stats[:topics_7_days] %></td>
|
||||
<td><%= @about.stats[:topics_30_days] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.post_count' %></td>
|
||||
<td><%= @about.stats[:post_count] %></td>
|
||||
<td><%= @about.stats[:posts_7_days] %></td>
|
||||
<td><%= @about.stats[:posts_30_days] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.user_count' %></td>
|
||||
<td><%= @about.stats[:user_count] %></td>
|
||||
<td><%= @about.stats[:users_7_days] %></td>
|
||||
<td><%= @about.stats[:users_30_days] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.active_user_count' %></td>
|
||||
<td>—</td>
|
||||
<td><%= @about.stats[:active_users_7_days] %></td>
|
||||
<td><%= @about.stats[:active_users_30_days] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.like_count' %></td>
|
||||
<td><%= @about.stats[:like_count] %></td>
|
||||
<td><%= @about.stats[:likes_7_days] %></td>
|
||||
<td><%= @about.stats[:likes_30_days] %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<br/>
|
||||
<br/>
|
|
@ -19,7 +19,7 @@
|
|||
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||
<%- end %>
|
||||
<header>
|
||||
<a href="<%= path "/" %>"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo"></a>
|
||||
<a href="<%= path "/" %>"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo" style="max-width: 400px;"></a>
|
||||
</header>
|
||||
<div id="main-outlet" class="wrap">
|
||||
<%= yield %>
|
||||
|
|
Loading…
Reference in a new issue