app.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. {{-- resources/views/layouts/blog.blade.php
  2. Blog 栏目布局。继承 layouts/base。
  3. 使用 Stack 主题 CSS(静态文件,不走 Vite)。
  4. 三栏结构:左边栏(博主信息+导航)/ 正文 / 右边栏(搜索+分类+标签)。
  5. 右边栏数据($categories, $tags, $archives)由 View Composer 自动注入。
  6. --}}
  7. @extends('layouts.base')
  8. @push('styles')
  9. <link rel="stylesheet"
  10. href="{{ URL::asset('assets/css/blog/style.min.css') }}">
  11. <link href="{{ URL::asset('assets/css/blog/css2') }}"
  12. type="text/css" rel="stylesheet">
  13. @endpush
  14. @section('body-class', '')
  15. @section('page')
  16. <div class="container main-container flex on-phone--column extended">
  17. {{-- ── 左边栏 ── --}}
  18. <aside class="sidebar left-sidebar sticky">
  19. <button class="hamburger hamburger--spin"
  20. type="button"
  21. id="toggle-menu"
  22. aria-label="Toggle Menu">
  23. <span class="hamburger-box">
  24. <span class="hamburger-inner"></span>
  25. </span>
  26. </button>
  27. <header>
  28. <figure class="site-avatar">
  29. <a href="{{ route('blog.index', ['user' => $user['userName']]) }}">
  30. <img src="{{ $user['avatar'] ?? '' }}"
  31. width="300" height="300"
  32. class="site-logo"
  33. loading="lazy"
  34. alt="Avatar" />
  35. </a>
  36. @if(!empty($user['level']))
  37. <span class="emoji" style="font-size: 11px;">LV{{ $user['level'] }}</span>
  38. @endif
  39. </figure>
  40. <div class="site-meta">
  41. <h1 class="site-name">
  42. <a href="{{ route('blog.index', ['user' => $user['userName']]) }}">
  43. {{ $user['nickName'] }}
  44. </a>
  45. </h1>
  46. @if(!empty($user['description']))
  47. <h2 class="site-description">{{ $user['description'] }}</h2>
  48. @endif
  49. </div>
  50. </header>
  51. {{-- 社交链接 --}}
  52. @if(!empty($user['social']))
  53. <ol class="menu-social">
  54. @foreach($user['social'] as $social)
  55. <li>
  56. <a href="{{ $social['url'] }}"
  57. target="_blank"
  58. title="{{ $social['name'] }}"
  59. rel="me">
  60. <i class="ti ti-brand-{{ strtolower($social['name']) }}"></i>
  61. </a>
  62. </li>
  63. @endforeach
  64. </ol>
  65. @endif
  66. {{-- 主导航 --}}
  67. <ol class="menu" id="main-menu">
  68. <li class="{{ request()->routeIs('blog.index') ? 'current' : '' }}">
  69. <a href="{{ route('blog.index', ['user' => $user['userName']]) }}">
  70. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-home"
  71. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  72. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  73. <path stroke="none" d="M0 0h24v24H0z"></path>
  74. <polyline points="5 12 3 12 12 3 21 12 19 12"></polyline>
  75. <path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"></path>
  76. <path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"></path>
  77. </svg>
  78. <span>Home</span>
  79. </a>
  80. </li>
  81. <li>
  82. <a href="#">
  83. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user"
  84. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  85. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  86. <path stroke="none" d="M0 0h24v24H0z"></path>
  87. <circle cx="12" cy="7" r="4"></circle>
  88. <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
  89. </svg>
  90. <span>About</span>
  91. </a>
  92. </li>
  93. <li class="{{ request()->routeIs('blog.archives*') ? 'current' : '' }}">
  94. <a href="{{ route('blog.archives', ['user' => $user['userName']]) }}">
  95. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-archive"
  96. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  97. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  98. <path stroke="none" d="M0 0h24v24H0z"></path>
  99. <rect x="3" y="4" width="18" height="4" rx="2"></rect>
  100. <path d="M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-10"></path>
  101. <line x1="10" y1="12" x2="14" y2="12"></line>
  102. </svg>
  103. <span>Archives</span>
  104. </a>
  105. </li>
  106. <li class="{{ request()->routeIs('blog.search') ? 'current' : '' }}">
  107. <a href="{{ route('blog.search', ['user' => $user['userName']]) }}">
  108. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-search"
  109. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  110. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  111. <path stroke="none" d="M0 0h24v24H0z"></path>
  112. <circle cx="10" cy="10" r="7"></circle>
  113. <line x1="21" y1="21" x2="15" y2="15"></line>
  114. </svg>
  115. <span>Search</span>
  116. </a>
  117. </li>
  118. {{-- 暗色模式切换 --}}
  119. <li class="menu-bottom-section">
  120. <ol class="menu">
  121. <li id="dark-mode-toggle">
  122. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-toggle-left"
  123. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  124. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  125. <path stroke="none" d="M0 0h24v24H0z"></path>
  126. <circle cx="8" cy="12" r="2"></circle>
  127. <rect x="2" y="6" width="20" height="12" rx="6"></rect>
  128. </svg>
  129. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-toggle-right"
  130. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  131. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  132. <path stroke="none" d="M0 0h24v24H0z"></path>
  133. <circle cx="16" cy="12" r="2"></circle>
  134. <rect x="2" y="6" width="20" height="12" rx="6"></rect>
  135. </svg>
  136. <span>Dark Mode</span>
  137. </li>
  138. </ol>
  139. </li>
  140. </ol>
  141. </aside>
  142. {{-- ── 正文 ── --}}
  143. <main class="main full-width">
  144. <div>
  145. @yield('content')
  146. </div>
  147. <footer class="site-footer">
  148. {{-- 博主版权 --}}
  149. <section class="copyright">
  150. &copy; 2020 - {{ date('Y') }} {{ $user['nickName'] }}
  151. </section>
  152. {{-- 主题版权(原样保留设计者信息) --}}
  153. <section class="powerby">
  154. &copy; 2020 - 2026 Hugo Theme Stack &nbsp;
  155. Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack"
  156. target="_blank" rel="noopener" data-version="3.30.0">Stack</a></b>
  157. designed by
  158. <a href="https://jimmycai.com/" target="_blank" rel="noopener">Jimmy</a>
  159. </section>
  160. </footer>
  161. </main>
  162. {{-- ── 右边栏 ── --}}
  163. <aside class="sidebar right-sidebar sticky">
  164. {{-- 搜索 --}}
  165. <form action="{{ route('blog.search', ['user' => $user['userName']]) }}"
  166. method="GET"
  167. class="search-form widget">
  168. <p>
  169. <label>Search</label>
  170. <input name="q"
  171. placeholder="Type something..."
  172. value="{{ request('q') }}" />
  173. <button type="submit" title="Search">
  174. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-search"
  175. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  176. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  177. <path stroke="none" d="M0 0h24v24H0z"></path>
  178. <circle cx="10" cy="10" r="7"></circle>
  179. <line x1="21" y1="21" x2="15" y2="15"></line>
  180. </svg>
  181. </button>
  182. </p>
  183. </form>
  184. {{-- Archives --}}
  185. @if(!empty($archives))
  186. <section class="widget archives">
  187. <div class="widget-icon">
  188. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-infinity"
  189. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  190. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  191. <path stroke="none" d="M0 0h24v24H0z"></path>
  192. <path d="M9.828 9.172a4 4 0 1 0 0 5.656 a10 10 0 0 0 2.172 -2.828a10 10 0 0 1 2.172 -2.828 a4 4 0 1 1 0 5.656a10 10 0 0 1 -2.172 -2.828a10 10 0 0 0 -2.172 -2.828"></path>
  193. </svg>
  194. </div>
  195. <h2 class="widget-title section-title">Archives</h2>
  196. <div class="widget-archive--list">
  197. @foreach($archives as $archive)
  198. <div class="archives-year">
  199. <a href="{{ route('blog.archives.year', ['user' => $user['userName'], 'year' => $archive['year']]) }}">
  200. <span class="year">{{ $archive['year'] }}</span>
  201. <span class="count">{{ $archive['count'] }}</span>
  202. </a>
  203. </div>
  204. @endforeach
  205. </div>
  206. </section>
  207. @endif
  208. {{-- Categories --}}
  209. @if(!empty($categories))
  210. <section class="widget tagCloud">
  211. <div class="widget-icon">
  212. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash"
  213. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  214. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  215. <path stroke="none" d="M0 0h24v24H0z"></path>
  216. <line x1="5" y1="9" x2="19" y2="9"></line>
  217. <line x1="5" y1="15" x2="19" y2="15"></line>
  218. <line x1="11" y1="4" x2="7" y2="20"></line>
  219. <line x1="17" y1="4" x2="13" y2="20"></line>
  220. </svg>
  221. </div>
  222. <h2 class="widget-title section-title">Categories</h2>
  223. <div class="tagCloud-tags">
  224. @foreach($categories as $category)
  225. <a href="{{ route('blog.category', ['user' => $user['userName'], 'category1' => $category['id']]) }}">
  226. {{ $category['label'] }}
  227. </a>
  228. @endforeach
  229. </div>
  230. </section>
  231. @endif
  232. {{-- Tags --}}
  233. @if(!empty($tags))
  234. <section class="widget tagCloud">
  235. <div class="widget-icon">
  236. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-tag"
  237. width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
  238. stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  239. <path stroke="none" d="M0 0h24v24H0z"></path>
  240. <path d="M11 3L20 12a1.5 1.5 0 0 1 0 2L14 20a1.5 1.5 0 0 1 -2 0L3 11v-4a4 4 0 0 1 4 -4h4"></path>
  241. <circle cx="9" cy="9" r="2"></circle>
  242. </svg>
  243. </div>
  244. <h2 class="widget-title section-title">Tags</h2>
  245. <div class="tagCloud-tags">
  246. @foreach($tags as $tag)
  247. <a href="{{ route('blog.tag', ['user' => $user['userName'], 'tag' => $tag['name']]) }}"
  248. class="font_size_1">
  249. {{ $tag['name'] }}
  250. </a>
  251. @endforeach
  252. </div>
  253. </section>
  254. @endif
  255. </aside>
  256. </div>
  257. @push('scripts')
  258. <script>
  259. (function() {
  260. const colorSchemeKey = "StackColorScheme";
  261. if (!localStorage.getItem(colorSchemeKey)) {
  262. localStorage.setItem(colorSchemeKey, "auto");
  263. }
  264. })();
  265. (function() {
  266. const colorSchemeKey = "StackColorScheme";
  267. const colorSchemeItem = localStorage.getItem(colorSchemeKey);
  268. const supportDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches === true;
  269. if (colorSchemeItem == "dark" || (colorSchemeItem === "auto" && supportDarkMode)) {
  270. document.documentElement.dataset.scheme = "dark";
  271. } else {
  272. document.documentElement.dataset.scheme = "light";
  273. }
  274. })();
  275. </script>
  276. <script src="{{ URL::asset('assets/js/blog/vibrant.min.js') }}"
  277. integrity="sha256-awcR2jno4kI5X0zL8ex0vi2z+KMkF24hUW8WePSA9HM="
  278. crossorigin="anonymous"></script>
  279. <script src="{{ URL::asset('assets/js/blog/main.1e9a3bafd846ced4c345d084b355fb8c7bae75701c338f8a1f8a82c780137826.js') }}"
  280. type="text/javascript" defer></script>
  281. <script>
  282. (function() {
  283. const customFont = document.createElement("link");
  284. customFont.href = "https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap";
  285. customFont.type = "text/css";
  286. customFont.rel = "stylesheet";
  287. document.head.appendChild(customFont);
  288. })();
  289. </script>
  290. @endpush
  291. @endsection