Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: OpenVox Documentation
description: Documentation for various OpenVox Projects.
url: https://docs.openvoxproject.org

logo: /assets/images/HexagonSticker.png

Expand All @@ -24,6 +25,14 @@ jekyll_vitepress:
logo:
default: 'https://github.com/voxpupuli/logos/blob/master/images/OpenVox/Sticker/HexagonSticker.svg?raw=true'
alt: OpenVox Automation Framework
# Social-card image for Open Graph / Twitter tags. Falls back to `logo`
# without this, but width/height are only emitted when set here.
seo:
image:
path: /assets/images/HexagonSticker.png
alt: OpenVox Documentation
width: 1200
height: 630
# Disabled as it adds extra size to generated HTML pages.
copy_page:
enabled: false
Expand Down
10 changes: 6 additions & 4 deletions _plugins/canonical_latest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,30 @@
# self-canonical: once `latest` moves on, their content is unique and the
# same page may not exist under /latest/.
#
# The origin is hardcoded, matching llms.txt, because site.url is unset.
# The production origin is the fallback for builds where `url` is unset
# (e.g. `jekyll serve` overrides it to localhost in development).
module OpenvoxDocs
module CanonicalLatest
ORIGIN = 'https://docs.openvoxproject.org'

def self.apply(site)
origin = site.config['url'].to_s.empty? ? ORIGIN : site.config['url']
(site.data['products'] || {}).each do |product_id, product|
version = Array(product['versions']).find { |v| v['id'] == product['latest'] }
next unless version

collection = site.collections[version['collection'].delete_prefix('_')]
next if collection.nil? || collection.label.end_with?('_latest')

canonicalize(collection, version['base'], "/#{product_id}/latest/")
canonicalize(collection, origin, version['base'], "/#{product_id}/latest/")
end
end

def self.canonicalize(collection, base, latest_base)
def self.canonicalize(collection, origin, base, latest_base)
collection.docs.each do |doc|
next unless doc.url.start_with?(base)

doc.data['canonical_url'] = "#{ORIGIN}#{latest_base}#{doc.url.delete_prefix(base)}"
doc.data['canonical_url'] = "#{origin}#{latest_base}#{doc.url.delete_prefix(base)}"
end
end
end
Expand Down