docyard 1.4.0 → 1.5.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: c329f7664eff5bca0fded133cdc29fffa5eea23f81a0183605ea1f038adfa819
4
- data.tar.gz: 5f4c135cd6a7dc25140d8111940d6a2fda14c4c9b142adb3d0c8b8a2c91a8f30
3
+ metadata.gz: 87ed8534117fd0298b55dbb0ec1155cf0fbedece5e85f16af79a802b984a2490
4
+ data.tar.gz: d8f1b0b03750a39d03bad5de72a012917c9938b73c5cfb59c0cf59eeaa0b623b
5
5
  SHA512:
6
- metadata.gz: bb2ccd83fef6197381df0dee879b71005fa6745842c242bd2fe4e2622d172356f0919b165c63791d6999f04f1cf8715f4dc5338d6050203f5133345ad52fcd9a
7
- data.tar.gz: 7a6ea46ba7dd06050e4157c018d158c904a9fbb86dcce352446a4b7d8c99199b641cd8094d5a5eb4074e59716df2abd3e30925fc19c8d4232f365a11d20524a5
6
+ metadata.gz: 6c704b6b8f2ca87e7149361e0cfe072572e9ad416313e1e73feb18b6db37222db60448215ccc8631dceaeace09c226d0b8642b1324d65652f5fe5972bc5bcdd7
7
+ data.tar.gz: 80f79afe9839766c31b68e37d5a2e70a3f402c208a0e78834cafc9afacea65e8112051f4a57e992855d29a401caee5f09b0b91c3f97ef341ecc7ca420d73ae40
data/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.5.0] - 2026-11-30
11
+
12
+ ### Added
13
+ - `navigation.logo_link` option to change where the header logo links to (#174)
14
+
15
+ ### Fixed
16
+ - `<meta name="description">` now uses the page's frontmatter `description`, falling back to the site description (#173)
17
+ - Page descriptions are now escaped in `description`, `og:description`, and `twitter:description` meta tags (#173)
18
+
19
+ ## [1.4.1] - 2026-11-03
20
+
21
+ ### Fixed
22
+ - `robots.txt` now uses an absolute Sitemap URL when `url` is configured (#165, #166)
23
+ - `sitemap.xml` entries now use absolute URLs when `url` is configured, as required by the sitemaps protocol (#169)
24
+
25
+ ### Changed
26
+ - Widened dependency ranges to support newer major versions: `rouge` (< 6), `puma` (< 9), and `parallel` (< 3) (#159, #161, #162)
27
+
10
28
  ## [1.4.0] - 2026-02-22
11
29
 
12
30
  ### Added
@@ -36,8 +36,8 @@ module Docyard
36
36
  end
37
37
 
38
38
  def build_sitemap(urls)
39
- base = config.build.base
40
- base = base.chop if base.end_with?("/")
39
+ base = config.url || config.build.base
40
+ base = base.chomp("/")
41
41
 
42
42
  xml = ['<?xml version="1.0" encoding="UTF-8"?>']
43
43
  xml << '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
@@ -141,14 +141,14 @@ module Docyard
141
141
  end
142
142
 
143
143
  def robots_txt_content
144
- base = config.build.base
145
- base = "#{base}/" unless base.end_with?("/")
144
+ base = config.url || config.build.base
145
+ base = base.chomp("/")
146
146
 
147
147
  <<~ROBOTS
148
148
  User-agent: *
149
149
  Allow: /
150
150
 
151
- Sitemap: #{base}sitemap.xml
151
+ Sitemap: #{base}/sitemap.xml
152
152
  ROBOTS
153
153
  end
154
154
  end
@@ -44,7 +44,7 @@ module Docyard
44
44
  def site_options
45
45
  {
46
46
  site_title: config.title || Constants::DEFAULT_SITE_TITLE,
47
- site_description: config.description || "",
47
+ site_description: config.description,
48
48
  site_url: config.url,
49
49
  og_image: config.og_image,
50
50
  twitter: config.twitter,
@@ -109,7 +109,8 @@ module Docyard
109
109
  def navigation_options
110
110
  cta_items = config.navigation.cta || []
111
111
  {
112
- header_ctas: normalize_cta_items(cta_items)
112
+ header_ctas: normalize_cta_items(cta_items),
113
+ logo_link: config.navigation.logo_link
113
114
  }
114
115
  end
115
116
 
@@ -42,6 +42,7 @@ module Docyard
42
42
  type: :hash,
43
43
  keys: {
44
44
  breadcrumbs: { type: :boolean },
45
+ logo_link: { type: :string, format: :url_or_absolute_path },
45
46
  cta: {
46
47
  type: :array,
47
48
  max_items: 2,
@@ -14,17 +14,31 @@ module Docyard
14
14
 
15
15
  def validate_format(value, format, field)
16
16
  case format
17
- when :no_slashes
18
- return unless value.include?("/") || value.include?("\\")
17
+ when :no_slashes then validate_no_slashes(value, field)
18
+ when :starts_with_slash then validate_starts_with_slash(value, field)
19
+ when :url_or_absolute_path then validate_url_or_absolute_path(value, field)
20
+ end
21
+ end
19
22
 
20
- add_diagnostic(:error, field, "cannot contain slashes", got: value,
21
- expected: "simple directory name like 'dist'")
22
- when :starts_with_slash
23
- return if value.start_with?("/")
23
+ def validate_no_slashes(value, field)
24
+ return unless value.include?("/") || value.include?("\\")
24
25
 
25
- add_diagnostic(:error, field, "must start with /", got: value,
26
- fix: { type: :replace, value: "/#{value}" })
27
- end
26
+ add_diagnostic(:error, field, "cannot contain slashes", got: value,
27
+ expected: "simple directory name like 'dist'")
28
+ end
29
+
30
+ def validate_starts_with_slash(value, field)
31
+ return if value.start_with?("/")
32
+
33
+ add_diagnostic(:error, field, "must start with /", got: value,
34
+ fix: { type: :replace, value: "/#{value}" })
35
+ end
36
+
37
+ def validate_url_or_absolute_path(value, field)
38
+ return if value.start_with?("/") || value.match?(%r{\Ahttps?://})
39
+
40
+ add_diagnostic(:warning, field, "should be a path starting with / or a URL starting with http(s)://",
41
+ got: value, fix: { type: :replace, value: "/#{value}" })
28
42
  end
29
43
 
30
44
  def validate_boolean(value, field)
@@ -21,7 +21,7 @@ module Docyard
21
21
  "sidebar" => "config",
22
22
  "build" => { "output" => "dist", "base" => "/", "strict" => false },
23
23
  "search" => { "enabled" => true, "placeholder" => "Search...", "exclude" => [] },
24
- "navigation" => { "cta" => [], "breadcrumbs" => true },
24
+ "navigation" => { "cta" => [], "breadcrumbs" => true, "logo_link" => nil },
25
25
  "announcement" => nil,
26
26
  "repo" => { "url" => nil, "branch" => "main", "edit_path" => nil, "edit_link" => true,
27
27
  "last_updated" => true },
@@ -170,7 +170,7 @@ module Docyard
170
170
 
171
171
  def normalize_options(options)
172
172
  return {} if options.nil?
173
- return options if options.is_a?(Hash) && options.keys.all? { |k| k.is_a?(Symbol) }
173
+ return options if options.is_a?(Hash) && options.keys.all?(Symbol)
174
174
 
175
175
  options.transform_keys(&:to_sym)
176
176
  end
@@ -19,6 +19,7 @@ module Docyard
19
19
  @logo_dark = branding[:logo_dark]
20
20
  @favicon = branding[:favicon] || Constants::DEFAULT_FAVICON_PATH
21
21
  @has_custom_logo = branding[:has_custom_logo] || false
22
+ @logo_link = branding[:logo_link] || "/"
22
23
  @primary_color = branding[:primary_color]
23
24
  end
24
25
 
@@ -74,8 +74,9 @@ module Docyard
74
74
  template = File.read(layout_path)
75
75
 
76
76
  assign_content_variables(content, page_title, navigation, raw_markdown)
77
+ @page_description = page_description.to_s.strip.empty? ? nil : page_description
77
78
  assign_branding_variables(branding, current_path)
78
- assign_og_variables(branding, page_description, page_og_image, current_path)
79
+ assign_og_variables(branding, @page_description, page_og_image, current_path)
79
80
  assign_template_variables(template_options)
80
81
  assign_git_info(branding, file_path)
81
82
  assign_feedback_variables
@@ -1,6 +1,6 @@
1
1
  <meta charset="UTF-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
3
- <meta name="description" content="<%= @site_description %>">
3
+ <meta name="description" content="<%= escape_html_attribute(@page_description || @site_description) %>">
4
4
  <meta name="view-transition" content="same-origin">
5
5
  <title><%= @page_title %> | <%= @site_title %></title>
6
6
  <link rel="icon" href="<%= asset_path(@favicon) %>" type="image/svg+xml">
@@ -13,7 +13,7 @@
13
13
  <meta property="og:title" content="<%= @page_title %>">
14
14
  <meta property="og:url" content="<%= @og_url %>">
15
15
  <% if @og_description && !@og_description.empty? %>
16
- <meta property="og:description" content="<%= @og_description %>">
16
+ <meta property="og:description" content="<%= escape_html_attribute(@og_description) %>">
17
17
  <% end %>
18
18
  <% if @og_image %>
19
19
  <meta property="og:image" content="<%= @og_image %>">
@@ -22,7 +22,7 @@
22
22
  <meta name="twitter:card" content="<%= @og_image ? 'summary_large_image' : 'summary' %>">
23
23
  <meta name="twitter:title" content="<%= @page_title %>">
24
24
  <% if @og_description && !@og_description.empty? %>
25
- <meta name="twitter:description" content="<%= @og_description %>">
25
+ <meta name="twitter:description" content="<%= escape_html_attribute(@og_description) %>">
26
26
  <% end %>
27
27
  <% if @og_image %>
28
28
  <meta name="twitter:image" content="<%= @og_image %>">
@@ -1,6 +1,6 @@
1
1
  <header class="header">
2
2
  <div class="header-content">
3
- <a href="<%= link_path('/') %>" class="header-logo">
3
+ <a href="<%= link_path(@logo_link) %>" class="header-logo">
4
4
  <% if @has_custom_logo %>
5
5
  <div class="site-logo-container">
6
6
  <img src="<%= asset_path(@logo) %>" alt="<%= @site_title %>" class="site-logo site-logo-light">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docyard
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-11-30 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: cssminify
@@ -83,30 +84,42 @@ dependencies:
83
84
  name: parallel
84
85
  requirement: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - "~>"
87
+ - - ">="
87
88
  - !ruby/object:Gem::Version
88
89
  version: '1.26'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '3.0'
89
93
  type: :runtime
90
94
  prerelease: false
91
95
  version_requirements: !ruby/object:Gem::Requirement
92
96
  requirements:
93
- - - "~>"
97
+ - - ">="
94
98
  - !ruby/object:Gem::Version
95
99
  version: '1.26'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.0'
96
103
  - !ruby/object:Gem::Dependency
97
104
  name: puma
98
105
  requirement: !ruby/object:Gem::Requirement
99
106
  requirements:
100
- - - "~>"
107
+ - - ">="
101
108
  - !ruby/object:Gem::Version
102
- version: '7.0'
109
+ version: '7'
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: '9'
103
113
  type: :runtime
104
114
  prerelease: false
105
115
  version_requirements: !ruby/object:Gem::Requirement
106
116
  requirements:
107
- - - "~>"
117
+ - - ">="
108
118
  - !ruby/object:Gem::Version
109
- version: '7.0'
119
+ version: '7'
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '9'
110
123
  - !ruby/object:Gem::Dependency
111
124
  name: rack
112
125
  requirement: !ruby/object:Gem::Requirement
@@ -125,16 +138,22 @@ dependencies:
125
138
  name: rouge
126
139
  requirement: !ruby/object:Gem::Requirement
127
140
  requirements:
128
- - - "~>"
141
+ - - ">="
129
142
  - !ruby/object:Gem::Version
130
- version: '4.0'
143
+ version: '4'
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: '6'
131
147
  type: :runtime
132
148
  prerelease: false
133
149
  version_requirements: !ruby/object:Gem::Requirement
134
150
  requirements:
135
- - - "~>"
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '4'
154
+ - - "<"
136
155
  - !ruby/object:Gem::Version
137
- version: '4.0'
156
+ version: '6'
138
157
  - !ruby/object:Gem::Dependency
139
158
  name: terser
140
159
  requirement: !ruby/object:Gem::Requirement
@@ -456,6 +475,7 @@ metadata:
456
475
  documentation_uri: https://docyard.dev
457
476
  bug_tracker_uri: https://github.com/sanifhimani/docyard/issues
458
477
  rubygems_mfa_required: 'true'
478
+ post_install_message:
459
479
  rdoc_options: []
460
480
  require_paths:
461
481
  - lib
@@ -470,7 +490,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
470
490
  - !ruby/object:Gem::Version
471
491
  version: '0'
472
492
  requirements: []
473
- rubygems_version: 3.7.2
493
+ rubygems_version: 3.5.22
494
+ signing_key:
474
495
  specification_version: 4
475
496
  summary: Generate beautiful documentation sites from Markdown
476
497
  test_files: []