diff --git a/code/DocumentationPage.php b/code/DocumentationPage.php index 7d2599f..5c5935d 100644 --- a/code/DocumentationPage.php +++ b/code/DocumentationPage.php @@ -108,7 +108,7 @@ class DocumentationPage extends ViewableData { */ function Link() { if($entity = $this->getEntity()) { - $link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativePath()); + $link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativeLink()); $link = rtrim(DocumentationService::trim_extension_off($link), '/'); @@ -125,6 +125,22 @@ class DocumentationPage extends ViewableData { return $link; } + /** + * Relative to the module base, not the webroot + * + * @return string + */ + function getRelativeLink() { + $link = rtrim(DocumentationService::trim_extension_off($this->getRelativePath()), '/'); + + // folders should have a / on them. Looks nicer + try { + if(is_dir($this->getPath())) $link .= '/'; + } catch (Exception $e) {}; + + return $link; + } + function setFullPath($path) { $this->fullPath = $path; }