6 Commits
Author SHA1 Message Date
kor-elf 136451dc5a Add breadcrumbs to site documentation views
- Integrate breadcrumb rendering across documentation views (`index`, `category`, `view`, and `no-default-version`).
- Add support for dynamic JSON-LD breadcrumb generation.
2026-07-25 23:10:37 +05:00
kor-elf 1ee453dcfe Add category path support to site documentation views
- Introduce `categoryPath` for `DocumentationService` methods.
- Resolve category paths dynamically based on parent or category ID.
2026-07-25 23:10:18 +05:00
kor-elf 2a26008e87 Add breadcrumbs to site views
- Introduce breadcrumb SCSS styles and integrate `breadcrumbs/site.blade.php`.
- Update SCSS imports to include new breadcrumb styles.
2026-07-25 23:09:49 +05:00
kor-elf 031aa196d1 Add breadcrumbs to site feedback page
- Extend breadcrumb definitions for `home` and `feedbacks.index`.
- Integrate breadcrumbs into the feedback page layout.
- Add support for dynamic JSON-LD breadcrumb rendering.
2026-07-25 22:34:21 +05:00
kor-elf c3b9fa56fb Add breadcrumbs and dynamic head stack to site layout
- Inject breadcrumbs into the main site layout for improved navigation.
- Add `@stack('head')` for dynamic head content integration.
2026-07-25 22:33:43 +05:00
kor-elf 0922ee217f Adjust breadcrumb icon styling in SCSS 2026-07-25 20:37:33 +05:00
12 changed files with 152 additions and 7 deletions
@@ -77,10 +77,16 @@ final class DocumentationService extends Service
return $this->errFobidden(__('Access is denied'));
}
$categoryPath = null;
if ($category->parent_id) {
$categoryPath = $this->documentationCategoryRepository->getPathFromRoot($category->parent_id, $documentation->getWebsiteTranslations()->getLanguage());
}
$data = array_merge($documentation->toArray(), [
'category' => $category,
'categories' => $this->getCategories($documentation, $category->id),
'documentations' => $this->getDocumentations($documentation, $category->id),
'categoryPath' => $categoryPath,
]);
return $this->resultSitePage($documentation->getProject(), $documentation->getWebsiteTranslations(), $data, \is_null($category->content?->title));
}
@@ -98,8 +104,14 @@ final class DocumentationService extends Service
return $this->errFobidden(__('Access is denied'));
}
$categoryPath = null;
if ($document->category_id) {
$categoryPath = $this->documentationCategoryRepository->getPathFromRoot($document->category_id, $documentation->getWebsiteTranslations()->getLanguage());
}
$data = array_merge($documentation->toArray(), [
'documentation' => $document,
'categoryPath' => $categoryPath,
]);
return $this->resultSitePage($documentation->getProject(), $documentation->getWebsiteTranslations(), $data, \is_null($document->content?->title));
}
+54 -2
View File
@@ -1,8 +1,60 @@
<?php
use App\Models\DocumentationCategory;
use App\Models\DocumentationVersion;
use App\Models\Documentation;
use App\Services\WebsiteTranslations;
use App\Enums\Site\ProjectSection;
use App\Models\Project;
use Diglactic\Breadcrumbs\Breadcrumbs;
use Illuminate\Support\Collection;
Breadcrumbs::for('home', function ($trail, WebsiteTranslations $websiteTranslations) {
$trail->push($websiteTranslations->translate('Home'), route('home'));
Breadcrumbs::for('home', function ($trail, Project $project, WebsiteTranslations $websiteTranslations) {
$trail->push($websiteTranslations->translate('Home'), ProjectSection::Home->url($project, $websiteTranslations->getLanguage()));
});
Breadcrumbs::for('feedbacks.index', function ($trail, Project $project, WebsiteTranslations $websiteTranslations) {
$trail->parent('home', $project, $websiteTranslations);
$trail->push($websiteTranslations->translate('site.Feedback'), ProjectSection::Feedback->url($project, $websiteTranslations->getLanguage()));
});
// Documentation
Breadcrumbs::for('documentation.no-default-version', function ($trail, Project $project, WebsiteTranslations $websiteTranslations) {
$trail->parent('home', $project, $websiteTranslations);
$trail->push($websiteTranslations->translate('site.Documentation'), ProjectSection::Documentation->url($project, $websiteTranslations->getLanguage()));
});
Breadcrumbs::for('documentation.index', function ($trail, Project $project, WebsiteTranslations $websiteTranslations, DocumentationVersion $version) {
$trail->parent('home', $project, $websiteTranslations);
$trail->push($websiteTranslations->translate('site.Documentation'), ProjectSection::DocumentationVersion->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug]));
});
Breadcrumbs::for('documentation.category-path', function ($trail, Project $project, WebsiteTranslations $websiteTranslations, DocumentationVersion $version, Collection $categoryPath) {
$trail->parent('documentation.index', $project, $websiteTranslations, $version);
foreach ($categoryPath as $pathItem) {
$trail->push(
$pathItem->content->title,
ProjectSection::DocumentationCategory->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $pathItem->slug])
);
}
});
Breadcrumbs::for('documentation.category', function ($trail, Project $project, WebsiteTranslations $websiteTranslations, DocumentationVersion $version, DocumentationCategory $category, ?Collection $categoryPath) {
$trail->parent('documentation.category-path', $project, $websiteTranslations, $version, $categoryPath ?? collect());
$trail->push(
$category->content->title,
ProjectSection::DocumentationCategory->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $category->slug])
);
});
Breadcrumbs::for('documentation.view', function ($trail, Project $project, WebsiteTranslations $websiteTranslations, DocumentationVersion $version, Documentation $documentation, ?Collection $categoryPath) {
$trail->parent('documentation.category-path', $project, $websiteTranslations, $version, $categoryPath ?? collect());
$trail->push(
$documentation->content->title,
ProjectSection::Documentation->url($project, $websiteTranslations->getLanguage(), ['version' => $version->slug, 'slug' => $documentation->slug])
);
});
// End Documentation
@@ -1,6 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import "reset";
@import "forms";
@import "breadcrumb";
html,
body {
@@ -0,0 +1,45 @@
.breadcrumb-container {
display: flex;
flex-wrap: wrap;
padding: .5rem 1rem;
margin-bottom: 1rem;
list-style: none;
background-color: #eee;
border-radius: .5rem;
}
.breadcrumb-item+.breadcrumb-item {
padding-left: .5rem
}
.breadcrumb-item+.breadcrumb-item:before {
float: left;
padding-right: .5rem;
color: #4b5563;
content: "/";
}
.breadcrumb-item.active {
color: #4b5563;
font-weight: 400;
}
.breadcrumb-item {
font-size: .75rem
}
.breadcrumb-item,.breadcrumb-item a {
color: #374151;
font-weight: 400;
font-size: .75rem;
}
.breadcrumb-item a:hover {
color: #00040b;
text-decoration: none;
}
@media (min-width: 576px) {
.breadcrumb-item,.breadcrumb-item a {
font-size:.875rem
}
}
@@ -0,0 +1,13 @@
@unless ($breadcrumbs->isEmpty())
<nav aria-label="breadcrumb" class="breadcrumb">
<ol class="breadcrumb-container">
@foreach ($breadcrumbs as $breadcrumb)
@if ($breadcrumb->url && !$loop->last)
<li class="breadcrumb-item"><a href="{{ $breadcrumb->url }}">{{ $breadcrumb->title }}</a></li>
@else
<li class="breadcrumb-item active" aria-current="page">{{ $breadcrumb->title }}</li>
@endif
@endforeach
</ol>
</nav>
@endunless
@@ -9,6 +9,8 @@
<meta name="description" content="@yield('meta_description', '')" />
@vite('resources/site/scss/app.scss')
@stack('head')
</head>
<body>
<div class="wrapper">
@@ -46,6 +48,7 @@
</nav>
<div class="section-container">
<div class="content">
@yield('breadcrumbs', '')
@if($attributes->has('documentationVersion'))
<x-site.documentation-version :websiteTranslations="$websiteTranslations" :version="$attributes->get('documentationVersion')" />
@endif
@@ -1,6 +1,9 @@
@section('meta_title', $websiteTranslations->translate('site.Feedback'))
@section('h1', $websiteTranslations->translate('site.Feedback'))
@section('breadcrumbs', Breadcrumbs::render('feedbacks.index', $project, $websiteTranslations))
@push('head')
{{ Breadcrumbs::view('breadcrumbs::json-ld', 'feedbacks.index', $project, $websiteTranslations) }}
@endpush
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations">
@if(Session::has('success') !== true)
<form method="post" action="{{ \App\Enums\Site\ProjectSection::FeedbackSend->url($project, $websiteTranslations->getLanguage()) }}">
@@ -1,6 +1,9 @@
@section('meta_title', $category->content?->title . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $category->content?->title)
@section('breadcrumbs', Breadcrumbs::render('documentation.category', $project, $websiteTranslations, $version, $category, $categoryPath))
@push('head')
{{ Breadcrumbs::view('breadcrumbs::json-ld', 'documentation.category', $project, $websiteTranslations, $version, $category, $categoryPath) }}
@endpush
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
@foreach($categories as $category)
@continue(! $category->content?->title)
@@ -1,6 +1,9 @@
@section('meta_title', $websiteTranslations->translate('site.Documentation') . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $websiteTranslations->translate('site.Documentation'))
@section('breadcrumbs', Breadcrumbs::render('documentation.index', $project, $websiteTranslations, $version))
@push('head')
{{ Breadcrumbs::view('breadcrumbs::json-ld', 'documentation.index', $project, $websiteTranslations, $version) }}
@endpush
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
@foreach($categories as $category)
@continue(! $category->content?->title)
@@ -1,6 +1,9 @@
@section('meta_title', $websiteTranslations->translate('site.Documentation not created'))
@section('h1', $websiteTranslations->translate('site.Documentation not created'))
@section('breadcrumbs', Breadcrumbs::render('documentation.no-default-version', $project, $websiteTranslations))
@push('head')
{{ Breadcrumbs::view('breadcrumbs::json-ld', 'documentation.no-default-version', $project, $websiteTranslations) }}
@endpush
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations">
</x-site.layout>
@@ -1,6 +1,9 @@
@section('meta_title', $documentation->content?->title . ' - ' . $project->name . ' ' . $version->title)
@section('h1', $documentation->content?->title)
@section('breadcrumbs', Breadcrumbs::render('documentation.view', $project, $websiteTranslations, $version, $documentation, $categoryPath))
@push('head')
{{ Breadcrumbs::view('breadcrumbs::json-ld', 'documentation.view', $project, $websiteTranslations, $version, $documentation, $categoryPath) }}
@endpush
<x-site.layout :project="$project" :websiteTranslations="$websiteTranslations" :documentationVersion="$version">
<div class="line-numbers">{!! $documentation->content->content !!}</div>
@push('scripts')
@@ -24,6 +24,10 @@
padding: 0;
}
.breadcrumb .icon {
margin-top: -2px;
}
@each $color, $value in $theme-colors {
.breadcrumb-#{$color} {
background: $value;