From 6be5055633b4ef9be358fdc82dfcc5fc1aad068b Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 31 May 2022 19:19:57 +0200 Subject: [PATCH 1/2] Fix bug #462 caused by trailing slash in docs path --- src/Models/DocumentationPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/DocumentationPage.php b/src/Models/DocumentationPage.php index 5b30b40c..36455246 100644 --- a/src/Models/DocumentationPage.php +++ b/src/Models/DocumentationPage.php @@ -22,6 +22,6 @@ public function __construct(array $matter, string $body, string $title = '', str public function getCurrentPagePath(): string { - return Hyde::docsDirectory().'/'.$this->slug; + return trim(Hyde::docsDirectory().'/'.$this->slug, '/'); } } From 4b5af09b36e25588a911084f13cbd8cc05a9e597 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 31 May 2022 19:29:35 +0200 Subject: [PATCH 2/2] Fix https://github.com/hydephp/framework/issues/462#issuecomment-1142408337 --- src/Concerns/Internal/FileHelpers.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Concerns/Internal/FileHelpers.php b/src/Concerns/Internal/FileHelpers.php index b3eaf03a..cb0891b5 100644 --- a/src/Concerns/Internal/FileHelpers.php +++ b/src/Concerns/Internal/FileHelpers.php @@ -19,8 +19,6 @@ trait FileHelpers * Naming suggestion is `getDocumentationOutputPath()`. * The configuration option has been renamed. * - * @todo Test and if needed add support for storing documentation files in the site root - * * @return string */ public static function docsDirectory(): string @@ -36,11 +34,11 @@ public static function docsDirectory(): string public static function docsIndexPath(): string|false { if (file_exists(static::path('_docs/index.md'))) { - return static::pageLink(static::docsDirectory().'/index.html'); + return trim(static::pageLink(static::docsDirectory().'/index.html'), '/'); } if (file_exists(static::path('_docs/readme.md'))) { - return static::pageLink(static::docsDirectory().'/readme.html'); + return trim(static::pageLink(static::docsDirectory().'/readme.html'), '/'); } return false;