wytch 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/wytch/cli.rb +0 -2
- data/lib/wytch/sitemap_helper.rb +35 -0
- data/lib/wytch/{templates/src/site/sitemap_view.rb.tt → sitemap_view.rb} +16 -2
- data/lib/wytch/templates/content/sitemap.rb.tt +2 -2
- data/lib/wytch/version.rb +1 -1
- metadata +3 -3
- data/lib/wytch/templates/src/site/sitemap_helper.rb.tt +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0437b28a3f15b9b8c8b038d704007549d041d037a06423bdc5e7e707d2f0406a
|
|
4
|
+
data.tar.gz: d3c6f678b5146c515096c32a0ef61bef367b6af875df257455699db790019223
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c9b98d2db33c4b4b1ae078ce992d1d8ff7965b5ace303cfa8f49148c52cd0f4564c1d36b2ddad6a46e548e27914bc70b8488aaf5ad51a009a084a037c710a1a
|
|
7
|
+
data.tar.gz: cbfefe11f6b4b6a74534cb150b136f90d370f71a11e8be5ca3f21e926292272233c1a723d96b11fc1b374239257205c3d71c0c3bcae8cb8bda2f5659585add88
|
data/CHANGELOG.md
CHANGED
data/lib/wytch/cli.rb
CHANGED
|
@@ -71,8 +71,6 @@ module Wytch
|
|
|
71
71
|
template("src/site/home_view.rb.tt", "#{name}/src/#{@site_name}/home_view.rb")
|
|
72
72
|
template("src/site/post_view.rb.tt", "#{name}/src/#{@site_name}/post_view.rb")
|
|
73
73
|
template("src/site/post_helpers.rb.tt", "#{name}/src/#{@site_name}/post_helpers.rb")
|
|
74
|
-
template("src/site/sitemap_view.rb.tt", "#{name}/src/#{@site_name}/sitemap_view.rb")
|
|
75
|
-
template("src/site/sitemap_helper.rb.tt", "#{name}/src/#{@site_name}/sitemap_helper.rb")
|
|
76
74
|
template("src/site/feed_view.rb.tt", "#{name}/src/#{@site_name}/feed_view.rb")
|
|
77
75
|
template("src/site/feed_helper.rb.tt", "#{name}/src/#{@site_name}/feed_helper.rb")
|
|
78
76
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Wytch
|
|
4
|
+
# Helper module for sitemap pages.
|
|
5
|
+
#
|
|
6
|
+
# This module provides methods to configure a page as a sitemap.
|
|
7
|
+
# It sets the correct path, build path, and excludes the sitemap
|
|
8
|
+
# itself from appearing in the sitemap.
|
|
9
|
+
#
|
|
10
|
+
# @example Using in a content file (content/sitemap.rb)
|
|
11
|
+
# view Wytch::SitemapView
|
|
12
|
+
# add Wytch::SitemapHelper
|
|
13
|
+
module SitemapHelper
|
|
14
|
+
# Returns the URL path for the sitemap.
|
|
15
|
+
#
|
|
16
|
+
# @return [String] "/sitemap.xml"
|
|
17
|
+
def path
|
|
18
|
+
"/sitemap.xml"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Returns the build path for the sitemap.
|
|
22
|
+
#
|
|
23
|
+
# @return [String] "sitemap.xml"
|
|
24
|
+
def build_path
|
|
25
|
+
"sitemap.xml"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Excludes the sitemap from appearing in the sitemap.
|
|
29
|
+
#
|
|
30
|
+
# @return [Boolean] false
|
|
31
|
+
def include_in_sitemap?
|
|
32
|
+
false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Wytch
|
|
4
|
+
# Generates an XML sitemap for the site.
|
|
5
|
+
#
|
|
6
|
+
# This view renders a sitemap.xml file listing all pages that have
|
|
7
|
+
# `include_in_sitemap?` returning true.
|
|
8
|
+
#
|
|
9
|
+
# @example Using in a content file (content/sitemap.rb)
|
|
10
|
+
# view Wytch::SitemapView
|
|
11
|
+
# add Wytch::SitemapHelper
|
|
4
12
|
class SitemapView
|
|
13
|
+
# Creates a new sitemap view.
|
|
14
|
+
#
|
|
15
|
+
# @param page [Page] the page object (not used but required for interface)
|
|
5
16
|
def initialize(page)
|
|
6
17
|
@page = page
|
|
7
18
|
end
|
|
8
19
|
|
|
20
|
+
# Renders the sitemap XML.
|
|
21
|
+
#
|
|
22
|
+
# @return [String] XML sitemap content
|
|
9
23
|
def call
|
|
10
24
|
require "builder"
|
|
11
25
|
|
|
12
|
-
xml = Builder::XmlMarkup.new(indent: 2)
|
|
26
|
+
xml = ::Builder::XmlMarkup.new(indent: 2)
|
|
13
27
|
xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
|
|
14
28
|
xml.urlset xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
|
15
29
|
Wytch.site.pages.values.each do |page|
|
data/lib/wytch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wytch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jared Norman
|
|
@@ -131,6 +131,8 @@ files:
|
|
|
131
131
|
- lib/wytch/server.rb
|
|
132
132
|
- lib/wytch/site.rb
|
|
133
133
|
- lib/wytch/site_code_loader_middleware.rb
|
|
134
|
+
- lib/wytch/sitemap_helper.rb
|
|
135
|
+
- lib/wytch/sitemap_view.rb
|
|
134
136
|
- lib/wytch/templates/Gemfile.tt
|
|
135
137
|
- lib/wytch/templates/config.rb.tt
|
|
136
138
|
- lib/wytch/templates/content/feed.rb.tt
|
|
@@ -150,8 +152,6 @@ files:
|
|
|
150
152
|
- lib/wytch/templates/src/site/page.rb.tt
|
|
151
153
|
- lib/wytch/templates/src/site/post_helpers.rb.tt
|
|
152
154
|
- lib/wytch/templates/src/site/post_view.rb.tt
|
|
153
|
-
- lib/wytch/templates/src/site/sitemap_helper.rb.tt
|
|
154
|
-
- lib/wytch/templates/src/site/sitemap_view.rb.tt
|
|
155
155
|
- lib/wytch/templates/vite.config.js.tt
|
|
156
156
|
- lib/wytch/version.rb
|
|
157
157
|
- sig/wytch.rbs
|