You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/12/03 12:04:00 UTC
[brooklyn-docs] branch master updated: use truly unique identifier, prevent occasional failures due to collisions
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git
The following commit(s) were added to refs/heads/master by this push:
new c8a8782 use truly unique identifier, prevent occasional failures due to collisions
c8a8782 is described below
commit c8a8782f9914de20427b86c0648a9c05838af0b0
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Fri Dec 3 12:03:45 2021 +0000
use truly unique identifier, prevent occasional failures due to collisions
---
_plugins/site_structure.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/_plugins/site_structure.rb b/_plugins/site_structure.rb
index 339677f..5fab084 100644
--- a/_plugins/site_structure.rb
+++ b/_plugins/site_structure.rb
@@ -187,12 +187,15 @@ module SiteStructure
# (but note, in the context hash map 'data' on pages is promoted, so you access it like {{ page.menu }})
end
+ @@unique_path_id = 1001
+
# processes liquid tags, e.g. in a link or path object
def render_liquid_with_page(site, page, content, path=nil)
return content unless page
if (!path)
- # path must be unique to the content ... ideally use a hash, but for now just:
- path = "random-#{rand(1000000)}"
+ # path must be unique to the content and page ... ideally use a hash, but for now just:
+ this_id = @@unique_path_id+=1
+ path = "one-off-path-#{this_id}"
end
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => page } }
page.render_liquid(content, site.site_payload, info, path)