Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
schleuder
schleuder-website
Commits
372d1339
Verified
Commit
372d1339
authored
Jan 17, 2020
by
georg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop obsolete breadcrumbs plugin
parent
4b624074
Pipeline
#33333
passed with stages
in 1 minute and 39 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
111 deletions
+0
-111
_plugins/breadcrumbs.rb
_plugins/breadcrumbs.rb
+0
-82
_plugins/drops/breadcrumb_item.rb
_plugins/drops/breadcrumb_item.rb
+0
-29
No files found.
_plugins/breadcrumbs.rb
deleted
100644 → 0
View file @
4b624074
require_relative
'drops/breadcrumb_item.rb'
module
Jekyll
module
Breadcrumbs
@@config
=
{}
@@siteAddress
=
""
@@sideAddresses
=
{}
def
self
.
clearAddressCache
@@sideAddresses
=
{}
end
def
self
.
loadAddressCache
(
site
)
clearAddressCache
site
.
documents
.
each
{
|
page
|
addAddressItem
(
page
.
url
,
page
[
'crumbtitle'
]
||
page
[
'title'
]
||
''
)
}
# collection files including posts
site
.
pages
.
each
{
|
page
|
addAddressItem
(
page
.
url
,
page
[
'crumbtitle'
]
||
page
[
'title'
]
||
''
)
}
# pages
site
.
posts
.
docs
.
each
{
|
page
|
addAddressItem
(
page
.
url
,
page
[
'crumbtitle'
]
||
page
[
'title'
]
||
''
)
}
# posts
end
def
self
.
addAddressItem
(
url
,
title
)
key
=
createAddressCacheKey
(
url
)
@@sideAddresses
[
key
]
=
{
:url
=>
url
,
:title
=>
title
}
end
def
self
.
findAddressItem
(
path
)
key
=
createAddressCacheKey
(
path
)
@@sideAddresses
[
key
]
if
key
end
def
self
.
createAddressCacheKey
(
path
)
path
.
chomp
(
"/"
).
empty?
?
"/"
:
path
.
chomp
(
"/"
)
end
def
self
.
buildSideBreadcrumbs
(
side
,
payload
)
payload
[
"breadcrumbs"
]
=
[]
return
if
side
.
url
==
@@siteAddress
&&
root_hide
===
true
drop
=
Jekyll
::
Drops
::
BreadcrumbItem
position
=
0
path
=
side
.
url
.
chomp
(
"/"
).
split
(
/(?=\/)/
)
(
-
1
..
(
path
.
size
-
1
)).
each
do
|
int
|
joined_path
=
int
==
-
1
?
""
:
path
[
0
..
int
].
join
item
=
findAddressItem
(
joined_path
)
if
item
position
+=
1
item
[
:position
]
=
position
item
[
:root_image
]
=
root_image
payload
[
"breadcrumbs"
]
<<
drop
.
new
(
item
)
end
end
end
# Config
def
self
.
loadConfig
(
site
)
config
=
site
.
config
[
"breadcrumbs"
]
||
{
"root"
=>
{
"hide"
=>
false
,
"image"
=>
false
}}
root
=
config
[
"root"
]
@@config
[
:root_hide
]
=
root
[
"hide"
]
||
false
@@config
[
:root_image
]
=
root
[
"image"
]
||
false
@@siteAddress
=
site
.
config
[
"baseurl"
]
||
"/"
@@siteAddress
=
"/"
if
@@siteAddress
.
empty?
end
def
self
.
root_hide
@@config
[
:root_hide
]
end
def
self
.
root_image
@@config
[
:root_image
]
end
end
end
Jekyll
::
Hooks
.
register
:site
,
:pre_render
do
|
site
,
payload
|
Jekyll
::
Breadcrumbs
::
loadConfig
(
site
)
Jekyll
::
Breadcrumbs
::
loadAddressCache
(
site
)
end
Jekyll
::
Hooks
.
register
[
:pages
,
:documents
],
:pre_render
do
|
side
,
payload
|
Jekyll
::
Breadcrumbs
::
buildSideBreadcrumbs
(
side
,
payload
)
end
_plugins/drops/breadcrumb_item.rb
deleted
100644 → 0
View file @
4b624074
module
Jekyll
module
Drops
class
BreadcrumbItem
<
Liquid
::
Drop
extend
Forwardable
def
initialize
(
side
)
@side
=
side
end
def
position
@side
[
:position
]
end
def
title
@side
[
:title
]
end
def
url
@side
[
:url
]
end
def
rootimage
@side
[
:root_image
]
end
end
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment