Skip to content

Commit

Permalink
Merge pull request #480 from hydephp/462-add-support-for-outputting-d…
Browse files Browse the repository at this point in the history
…ocumentation-pages-to-root-output-directory

Fix support for outputting documentation pages to root output directory
  • Loading branch information
caendesilva authored May 31, 2022
2 parents 773d85b + 4b5af09 commit 0dae85b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/Concerns/Internal/FileHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/DocumentationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '/');
}
}

0 comments on commit 0dae85b

Please sign in to comment.