docyard 1.4.1 → 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: c34625ed1c0aee98891a94ac6d144f9660aa8493492e7f2a20dec2a344e38103
4
- data.tar.gz: 271198813cf0eb7f88154976c927d47ff521ce5ba365cb0c335d6976f18d1eda
3
+ metadata.gz: 87ed8534117fd0298b55dbb0ec1155cf0fbedece5e85f16af79a802b984a2490
4
+ data.tar.gz: d8f1b0b03750a39d03bad5de72a012917c9938b73c5cfb59c0cf59eeaa0b623b
5
5
  SHA512:
6
- metadata.gz: '092ac5fb44e695fc1271eeb96e8f781d3258303431ea57dee56b3f7ceb6a8b83b54ba5e5000c8ea12d5fbc3eb99cb22fed380ca9b14de2b3408abf4645ff77e7'
7
- data.tar.gz: 68ac38bb44491ebf564a489c3d14a4ba2ea945bd0b62cc2dc9433178f97e5961a01526945087a8b9778f3deaef37e6c7481a4ec903172a741b34f04a96bffe73
6
+ metadata.gz: 6c704b6b8f2ca87e7149361e0cfe072572e9ad416313e1e73feb18b6db37222db60448215ccc8631dceaeace09c226d0b8642b1324d65652f5fe5972bc5bcdd7
7
+ data.tar.gz: 80f79afe9839766c31b68e37d5a2e70a3f402c208a0e78834cafc9afacea65e8112051f4a57e992855d29a401caee5f09b0b91c3f97ef341ecc7ca420d73ae40
data/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ 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
+
10
19
  ## [1.4.1] - 2026-11-03
11
20
 
12
21
  ### Fixed
@@ -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 },
@@ -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.1"
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.1
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
@@ -474,6 +475,7 @@ metadata:
474
475
  documentation_uri: https://docyard.dev
475
476
  bug_tracker_uri: https://github.com/sanifhimani/docyard/issues
476
477
  rubygems_mfa_required: 'true'
478
+ post_install_message:
477
479
  rdoc_options: []
478
480
  require_paths:
479
481
  - lib
@@ -488,7 +490,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
488
490
  - !ruby/object:Gem::Version
489
491
  version: '0'
490
492
  requirements: []
491
- rubygems_version: 3.7.2
493
+ rubygems_version: 3.5.22
494
+ signing_key:
492
495
  specification_version: 4
493
496
  summary: Generate beautiful documentation sites from Markdown
494
497
  test_files: []