jekyll-vitepress-theme 1.8.0 → 1.8.1

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: 7ca0f243e32e2dd051ee2c8bd0c073ec5ab1d2469d05e606531df740508a036f
4
- data.tar.gz: caac258aed1a827394fdf8f6f239d81a6978b297567d5558c8433ead4504ded9
3
+ metadata.gz: 9e8e0506d69bd7172baf0392133cc0782815c07784a747437be2b7a59503ca37
4
+ data.tar.gz: 7037f54855dc45578def24ab7144a563f9211f7a441b110bfa56172cebdff91d
5
5
  SHA512:
6
- metadata.gz: 04b1d2d66942c3c0e8277955be4936e268a8f7cbc0d3a818e6e7685ca7cc6b89f35944b252444ce708f6334a48e5d2a8cf62f55a3bcb707669c5fe33616db39d
7
- data.tar.gz: 3d72ee616cf769d5c242de1bd5a0de440187206ecece4574fab664a5d98fc12efb0597b8dc1e2995c356602ba66676e351ffb3112b1fbe3c04f532ceec431bf6
6
+ metadata.gz: '08cad3bf3e61558a9ca8a9832f1ad95943289691c6832961405551f62d43399294a3f709f1e120a5a265a664c39ee46b3591a2e39dd20e3dc3ad92b3c603ea46'
7
+ data.tar.gz: 2cedeabbc9f8be7ded0ed39164d7808bc63178e84a7ef06aa2da6bddcfd6262047490eff29eb36da1dcd80393c0aba1bc33cc4340a5358af02bc4373c02f568e
data/README.md CHANGED
@@ -78,6 +78,14 @@ bundle install
78
78
  bundle exec jekyll serve --livereload
79
79
  ```
80
80
 
81
+ ### Metadata and jekyll-seo-tag
82
+
83
+ The theme writes the page description, canonical link, Open Graph, and Twitter
84
+ card tags itself. Calling `{% seo %}` as well emits a second copy of each, so
85
+ drop it when you switch to this theme, or drop the theme's tags if you prefer
86
+ jekyll-seo-tag's. Its JSON-LD has no equivalent here, so keep that plugin if
87
+ you want structured data.
88
+
81
89
  ## Screenshots
82
90
 
83
91
  | Home | Docs |
data/_includes/nav.html CHANGED
@@ -103,8 +103,20 @@
103
103
  {% if versions and versions.items and versions.items.size > 0 %}
104
104
  <div class="VPVersionSelector" id="vp-version-selector">
105
105
  <button type="button" class="button" id="vp-version-button" aria-haspopup="true" aria-expanded="false" aria-controls="vp-version-menu">
106
+ {%- comment -%}
107
+ `current` names an item, by id or title, the way
108
+ version_link.html matches it. Show that item's title so a
109
+ manifest holding ids does not label the button "next".
110
+ {%- endcomment -%}
111
+ {%- assign version_current_label = versions.current -%}
112
+ {%- for version_item in versions.items -%}
113
+ {%- assign version_item_key = version_item.id | default: version_item.title -%}
114
+ {%- if version_item_key == versions.current or version_item.title == versions.current -%}
115
+ {%- assign version_current_label = version_item.title -%}
116
+ {%- endif -%}
117
+ {%- endfor -%}
106
118
  <span class="text">
107
- <span>{{ versions.current | default: 'Version' }}</span>
119
+ <span>{{ version_current_label | default: 'Version' }}</span>
108
120
  <span class="vpi-chevron-down text-icon"></span>
109
121
  </span>
110
122
  </button>
@@ -329,6 +329,11 @@ body.vp-nav-screen-open .VPNav {
329
329
  width: 100%;
330
330
  height: 100%;
331
331
  fill: currentcolor;
332
+
333
+ /* These icons draw a 16-unit viewBox into a 13-14px box. Their paths touch
334
+ the viewBox edge, so at a fractional scale the SVG viewport clips the
335
+ outermost column and the shape looks flat on one side. */
336
+ overflow: visible;
332
337
  }
333
338
 
334
339
  .VPNavBarStarText,
@@ -1120,6 +1125,11 @@ body.vp-search-open {
1120
1125
  width: 100%;
1121
1126
  height: 100%;
1122
1127
  fill: currentcolor;
1128
+
1129
+ /* These icons draw a 16-unit viewBox into a 13-14px box. Their paths touch
1130
+ the viewBox edge, so at a fractional scale the SVG viewport clips the
1131
+ outermost column and the shape looks flat on one side. */
1132
+ overflow: visible;
1123
1133
  }
1124
1134
 
1125
1135
  .VPMetricButtonCount {
@@ -17,9 +17,26 @@ module Jekyll
17
17
  Jekyll.logger.warn('jekyll-vitepress-theme', "Sidebar hierarchy generation failed: #{e.message}")
18
18
  end
19
19
 
20
+ # A site with collection documents and no _data/sidebar.yml builds a page
21
+ # with an empty sidebar and no other complaint, which is a slow thing to
22
+ # notice. Overriding `data_dir` without carrying the file over is the
23
+ # usual cause.
24
+ def warn_missing_sidebar_data(site)
25
+ return if site.collections.values.all? { |collection| collection.docs.empty? }
26
+
27
+ Jekyll.logger.warn(
28
+ 'jekyll-vitepress-theme',
29
+ 'No _data/sidebar.yml found, so the sidebar will be empty. ' \
30
+ 'If you set a custom data_dir, copy the theme data files into it.'
31
+ )
32
+ end
33
+
20
34
  def generate(site)
21
35
  sidebar_groups = site.data['sidebar']
22
- return nil unless sidebar_groups.respond_to?(:each)
36
+ unless sidebar_groups.respond_to?(:each)
37
+ warn_missing_sidebar_data(site)
38
+ return nil
39
+ end
23
40
 
24
41
  groups = sidebar_groups.filter_map { |group| generated_group(site, group) }
25
42
 
@@ -384,7 +401,18 @@ module Jekyll
384
401
  module_function
385
402
 
386
403
  AUTO_VALUE = 'auto'.freeze
387
-
404
+ VERSION_PATTERN = /VERSION\s*=\s*['"]([^'"]+)['"]/
405
+
406
+ # Resolves `current: auto` to the version of the project being documented.
407
+ # Configure where to read it from:
408
+ #
409
+ # jekyll_vitepress:
410
+ # version:
411
+ # value: "2.0.0" # literal, wins over file
412
+ # file: lib/my_gem/version.rb # or a file holding VERSION = '...'
413
+ #
414
+ # With neither, it falls back to this theme's own version, which is only
415
+ # ever right for the theme's own documentation.
388
416
  def apply(site)
389
417
  versions = site.data['versions']
390
418
  return unless versions.is_a?(Hash)
@@ -392,11 +420,35 @@ module Jekyll
392
420
  current_value = versions['current'] || versions[:current]
393
421
  return unless auto_value?(current_value)
394
422
 
395
- versions['current'] = "v#{Jekyll::VitePressTheme::VERSION}"
423
+ versions['current'] = "v#{site_version(site) || Jekyll::VitePressTheme::VERSION}"
396
424
  rescue StandardError => e
397
425
  Jekyll.logger.warn('jekyll-vitepress-theme', "Version label resolution failed: #{e.message}")
398
426
  end
399
427
 
428
+ def site_version(site)
429
+ config = site.config.dig('jekyll_vitepress', 'version')
430
+ return nil unless config.is_a?(Hash)
431
+
432
+ literal = config['value'].to_s.strip
433
+ return normalize(literal) unless literal.empty?
434
+
435
+ version_from_file(site, config['file'])
436
+ end
437
+
438
+ def version_from_file(site, path)
439
+ return nil if path.to_s.strip.empty?
440
+
441
+ full_path = File.expand_path(path.to_s, site.source)
442
+ return nil unless File.file?(full_path)
443
+
444
+ match = File.read(full_path)[VERSION_PATTERN]
445
+ match && normalize(Regexp.last_match(1))
446
+ end
447
+
448
+ def normalize(value)
449
+ value.to_s.strip.sub(/\Av/, '')
450
+ end
451
+
400
452
  def auto_value?(value)
401
453
  value.to_s.strip.casecmp(AUTO_VALUE).zero?
402
454
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module VitePressTheme
3
- VERSION = "1.8.0".freeze
3
+ VERSION = "1.8.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-vitepress-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-22 00:00:00.000000000 Z
11
+ date: 2026-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll