diff --git a/app/Classes/Bundle.php b/app/Classes/Bundle.php index 28047a6..0da9d15 100644 --- a/app/Classes/Bundle.php +++ b/app/Classes/Bundle.php @@ -116,6 +116,16 @@ public function repair(): void $this->save(); } + public function getArticleTitle(): string + { + return $this->metadata()->get('title') ?? Str::title(basename($this->path)); + } + + public function getSiteTitle(): string + { + return $this->getArticleTitle() . ' - ' . $this->getSection(); + } + public function render() { $renderer = BundleRenderer::getBundleRendererFor($this); diff --git a/app/Classes/Link.php b/app/Classes/Link.php index 3bcada7..3b8dac4 100644 --- a/app/Classes/Link.php +++ b/app/Classes/Link.php @@ -291,7 +291,7 @@ private function fetchBundleTitle(): string $bundle->load(); $date = $bundle->metadata()->get('date'); - $title = $bundle->metadata()->get('title'); + $title = $bundle->getArticleTitle(); $section = $bundle->getSection(); if (!empty($date)) {