Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pablo Rauzy
cigala
Commits
924050a3
Commit
924050a3
authored
May 31, 2021
by
Pablo Rauzy
Browse files
fix relative link bug when header links to group at root of website
parent
f7369949
Changes
1
Hide whitespace changes
Inline
Side-by-side
root/cigala.php
View file @
924050a3
...
...
@@ -273,6 +273,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
$group_file
=
@
reset
(
array_filter
(
$menu
,
function
(
$p
)
{
return
$p
[
'status'
]
!=
'lnk'
;
}))[
'file'
];
$page_entries
=
array_filter
(
$entries
,
function
(
$e
)
use
(
$file
)
{
return
$e
[
'page'
]
==
$file
;
});
$relroot
=
str_repeat
(
'../'
,
substr_count
(
$file
,
'/'
));
if
(
empty
(
$relroot
))
$relroot
=
'/'
;
$title_head
=
str_replace
(
array
(
'%site%'
,
'%group%'
,
'%page%'
),
array
(
$settings
[
'title'
],
$groups
[
$group
][
'name'
],
$page
[
'title'
]),
$settings
[
'title_hformat'
]);
...
...
@@ -280,7 +281,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
array
(
$settings
[
'title'
],
$groups
[
$group
][
'name'
],
$page
[
'title'
]),
$settings
[
'title_bformat'
]);
$title_url
=
str_replace
(
array
(
'%site%'
,
'%group%'
,
'%page%'
),
array
(
empty
(
$relroot
)
?
'/'
:
$relroot
,
(
$group
==
-
1
)
?
$settings
[
'url'
]
:
$relroot
.
preg_replace
(
'/index\.html$/'
,
''
,
$group_file
),
$relroot
.
preg_replace
(
'/index\.html$/'
,
''
,
$page
[
'file'
])),
array
(
$relroot
,
(
$group
==
-
1
)
?
$settings
[
'url'
]
:
$relroot
.
preg_replace
(
'/index\.html$/'
,
''
,
$group_file
),
$relroot
.
preg_replace
(
'/index\.html$/'
,
''
,
$page
[
'file'
])),
$settings
[
'title_bformat'
]);
if
(
$mode
==
'publish'
)
{
ob_start
();
}
?><!doctype HTML>
...
...
@@ -311,7 +312,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
<menu>
<?php
foreach
(
$menu
as
$p
)
:
?>
<li
<?php
if
(
$p
[
'file'
]
==
$file
)
{
echo
' class="current"'
;
}
?>
>
<a
href=
"
<?php
echo
(
$mode
!=
'publish'
)
?
CIGALA_PHP
.
'?edit='
.
$p
[
'file'
]
:
((
$p
[
'status'
]
==
'lnk'
)
?
((
strpos
(
$p
[
'content'
],
'//'
)
===
false
)
?
$relroot
:
''
)
.
$p
[
'content'
]
:
$relroot
.
preg_replace
(
'/\/?index\.html$/'
,
'
/
'
,
$p
[
'file'
]));
?>
"
>
<?php
echo
$p
[
'title'
];
?>
</a>
<a
href=
"
<?php
echo
(
$mode
!=
'publish'
)
?
CIGALA_PHP
.
'?edit='
.
$p
[
'file'
]
:
((
$p
[
'status'
]
==
'lnk'
)
?
((
strpos
(
$p
[
'content'
],
'//'
)
===
false
)
?
$relroot
:
''
)
.
$p
[
'content'
]
:
$relroot
.
preg_replace
(
'/\/?index\.html$/'
,
''
,
$p
[
'file'
]));
?>
"
>
<?php
echo
$p
[
'title'
];
?>
</a>
</li>
<?php
endforeach
;
?>
</menu>
...
...
Write
Preview
Supports
Markdown
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