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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aa017b3a2d6ed1b64cde7b4a73f312222d64a630a365ad71db68f4babc28ce5
4
- data.tar.gz: fba837a626f3c4dfcc3525d03127ada6b62b30b367e31da4c5eef3721c7b264a
3
+ metadata.gz: 0437b28a3f15b9b8c8b038d704007549d041d037a06423bdc5e7e707d2f0406a
4
+ data.tar.gz: d3c6f678b5146c515096c32a0ef61bef367b6af875df257455699db790019223
5
5
  SHA512:
6
- metadata.gz: b70258ec6436a644dee4ecb637dc0bcad929428c7803d4272b7eef34b8bb0620b024c683a2a77f41e1235c05f5c1713b188a374bc7d050bb77a571bd924db7f0
7
- data.tar.gz: 98a84928a3cf7bd5aff50e99225d6b944da43ca69a44c2bb94a10ee8bc5ba424365ca228378f2f2472757b25632f86b7b5bea0aaa458e075100e2b96f1f87985
6
+ metadata.gz: 1c9b98d2db33c4b4b1ae078ce992d1d8ff7965b5ace303cfa8f49148c52cd0f4564c1d36b2ddad6a46e548e27914bc70b8488aaf5ad51a009a084a037c710a1a
7
+ data.tar.gz: cbfefe11f6b4b6a74534cb150b136f90d370f71a11e8be5ca3f21e926292272233c1a723d96b11fc1b374239257205c3d71c0c3bcae8cb8bda2f5659585add88
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.0] - 2025-12-7
4
+
5
+ - Move sitemap generation to Wytch core (`Wytch::SitemapView` and `Wytch::SitemapHelper`)
6
+
3
7
  ## [0.3.0] - 2025-12-7
4
8
 
5
9
  - Add YARD documentation to all classes and methods
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 <%= @site_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|
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- add <%= @site_module %>::SitemapHelper
4
- view <%= @site_module %>::SitemapView
3
+ add Wytch::SitemapHelper
4
+ view Wytch::SitemapView
data/lib/wytch/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Wytch
4
4
  # The current version of Wytch.
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
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.3.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
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module <%= @site_module %>
4
- module SitemapHelper
5
- def path
6
- "/sitemap.xml"
7
- end
8
-
9
- def build_path
10
- "sitemap.xml"
11
- end
12
-
13
- def include_in_sitemap?
14
- false
15
- end
16
- end
17
- end