File tree Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 13
13
) %>
14
14
<%= render "application/skip_to_content" %>
15
15
<%= render_layout "application" do %>
16
- <article itemscope itemtype ="http://schema.org/Article ">
16
+ <article itemscope itemtype ="http://schema.org/Article " class =" mb-3xl " >
17
17
<%= render Pages ::Header . new (
18
18
title : current_page . data . title! ,
19
19
description : current_page . data . description ,
33
33
</ nav >
34
34
</ aside >
35
35
<%- end -%>
36
- < div class ="article-content container mb-3xl " itemprop ="articleBody ">
36
+ < div class ="article-content container " itemprop ="articleBody ">
37
37
<%= yield %>
38
38
</ div >
39
+ <% if @page . topics . any? %>
40
+ < section class ="section-content container ">
41
+ <%= render Pages ::Topics . new ( topics : @page . topics . pluck ( :slug ) ) %>
42
+ </ section >
43
+ <% end %>
39
44
</ article >
40
45
< section id ="newsletter-signup ">
41
46
<%= render "users/newsletter_subscriptions/banner" %>
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ class SiteController < Sitepress::SiteController
5
5
# render_resource is a helper method provided by Sitepress to render the current resource.
6
6
# requested_resource is the Sitepress::Resource object that represents the current page.
7
7
#
8
- # def show
9
- # render_resource requeste_resource
10
- # end
8
+ def show
9
+ @page = Page . find_or_initialize_by ( request_path : request . path )
10
+
11
+ super
12
+ end
11
13
12
14
protected
13
15
@@ -19,7 +21,7 @@ class SiteController < Sitepress::SiteController
19
21
#
20
22
# For example, the rendition could be modified via `Nokogiri::HTML5::DocumentFragment(rendition)`.
21
23
#
22
- # @param rendition [Sitepress::Rendition] Rendered representatio of current_resource
24
+ # @param rendition [Sitepress::Rendition] Rendered representation of current_resource
23
25
#
24
26
def process_rendition ( rendition )
25
27
end
Original file line number Diff line number Diff line change 14
14
< li >
15
15
< a href ="/articles "> Articles</ a >
16
16
</ li >
17
+ < li >
18
+ <%= link_to "Topics" , topics_path %>
19
+ </ li >
17
20
< li >
18
21
<%= link_to "Snippets" , share_snippets_path %>
19
22
</ li >
Original file line number Diff line number Diff line change
1
+ module Pages
2
+ class Topics < ApplicationComponent
3
+ include PhlexConcerns ::FlexBlock
4
+
5
+ attr_reader :topics
6
+
7
+ def initialize ( topics : [ ] )
8
+ @topics = topics
9
+ end
10
+
11
+ def view_template
12
+ if topics . empty?
13
+ plain ""
14
+ return
15
+ end
16
+
17
+ p ( class : "topics" ) do
18
+ topics . each do |topic |
19
+ a ( href : topic_path ( topic ) , class : "topic step--1" ) do
20
+ "##{ topic . try ( :slug ) || topic } "
21
+ end
22
+ whitespace
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
You can’t perform that action at this time.
0 commit comments