feat: 页面模板差异化改进 + 配置优化 + 兼容清理 (#29)
- 首页判定:navigation 第一项 - 模板:page/projects/articles/bookmarks/search-results - bookmarks:update: YYYY-MM-DD | from: git|mtime - articles:RSS 聚合只读条目 + 分类聚合 + 影子写回结构 - projects:repo 卡片 + 可选热力图 + 自动抓取元信息 - 工作流:构建前 sync + schedule 定时刷新 - 移除兼容:config.yml/config.yaml、navigation.yml、home 特例 - 迁移说明:config/update-instructions.md
This commit is contained in:
@@ -1,14 +1,66 @@
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
{{!-- articles.hbs - 文章页面:恢复分类展示;Phase 2 优先展示文章条目(只读) --}}
|
||||
<div class="page-template page-template-articles">
|
||||
{{> page-header}}
|
||||
|
||||
{{#if articlesItems.length}}
|
||||
{{!-- Phase 2:按配置分类聚合展示文章条目(只读),保持与页面分类结构一致 --}}
|
||||
{{#if articlesCategories.length}}
|
||||
{{#each articlesCategories}}
|
||||
<section class="category category-level-1 category-readonly">
|
||||
<div class="category-header" data-toggle="category">
|
||||
<h2>
|
||||
<i class="{{#if icon}}{{icon}}{{else}}fas fa-rss{{/if}}"></i>
|
||||
{{name}}
|
||||
<span class="toggle-icon">
|
||||
<i class="fas fa-chevron-down"></i>
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="category-content">
|
||||
{{#if items.length}}
|
||||
<div class="sites-grid">
|
||||
{{#each items}}
|
||||
{{> site-card type="article" style=@root.siteCardStyle}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="empty-content">暂无文章</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
</section>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
{{!-- 兜底:无分类映射时展示为单一“最新文章”列表 --}}
|
||||
<section class="category category-level-1 category-readonly">
|
||||
<div class="category-header" data-toggle="category">
|
||||
<h2>
|
||||
<i class="fas fa-rss"></i>
|
||||
最新文章
|
||||
<span class="toggle-icon">
|
||||
<i class="fas fa-chevron-down"></i>
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="category-content">
|
||||
<div class="sites-grid">
|
||||
{{#each articlesItems}}
|
||||
{{> site-card type="article" style=@root.siteCardStyle}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{!-- 保留扩展可写回结构(隐藏),避免文章条目影响 DOM → IR → YAML --}}
|
||||
<div class="menav-extension-shadow" data-extension-shadow="true" data-search-exclude="true" aria-hidden="true">
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{else}}
|
||||
{{!-- Phase 1:来源站点入口(可写回) --}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{> page-header}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
@@ -1,14 +0,0 @@
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
@@ -1,142 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{site.title}}</title>
|
||||
<link rel="icon" href="./{{site.favicon}}" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="./{{site.favicon}}" type="image/x-icon">
|
||||
<link href="{{{googleFontsLink}}}" rel="stylesheet">
|
||||
<style>
|
||||
{{{fontVariables}}}
|
||||
</style>
|
||||
<!-- 预设主题和侧边栏状态,避免闪烁 -->
|
||||
<script>
|
||||
(function() {
|
||||
// 读取并应用主题设置
|
||||
var savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme === 'light') {
|
||||
document.documentElement.classList.add('theme-preload');
|
||||
}
|
||||
|
||||
// 读取并应用侧边栏状态
|
||||
var sidebarCollapsed = localStorage.getItem('sidebarCollapsed') === 'true';
|
||||
var isMobile = window.innerWidth <= 768;
|
||||
if (sidebarCollapsed && !isMobile) {
|
||||
document.documentElement.classList.add('sidebar-collapsed-preload');
|
||||
}
|
||||
|
||||
// 添加这个类用于控制初始渲染
|
||||
document.documentElement.classList.add('preload');
|
||||
})();
|
||||
</script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.7.2/css/all.min.css">
|
||||
</head>
|
||||
<body class="loading">
|
||||
<!-- 滚动进度指示条 -->
|
||||
<div class="scroll-progress"></div>
|
||||
<div class="layout">
|
||||
<!-- 移动端按钮 -->
|
||||
<div class="mobile-buttons">
|
||||
<button class="menu-toggle" aria-label="切换菜单">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
<button class="search-toggle" aria-label="切换搜索">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 遮罩层 -->
|
||||
<div class="overlay"></div>
|
||||
|
||||
<!-- 左侧导航 -->
|
||||
<nav class="sidebar">
|
||||
<div class="logo">
|
||||
<h1>{{site.logo_text}}</h1>
|
||||
<button class="sidebar-toggle" aria-label="收起/展开侧边栏">
|
||||
<i class="fas fa-chevron-left toggle-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-content">
|
||||
<div class="nav-section">
|
||||
{{#each navigationData}}
|
||||
{{> navigation}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
<div class="social-links">
|
||||
{{> social-links}}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 右侧内容区 -->
|
||||
<main class="content">
|
||||
<!-- 顶部操作栏 -->
|
||||
<div class="main-header">
|
||||
<div class="left-actions">
|
||||
<button class="theme-toggle" aria-label="切换主题">
|
||||
<i class="fas fa-moon"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="search-container">
|
||||
<div class="search-input-container">
|
||||
<i class="fas fa-search"></i>
|
||||
<input type="text" class="search-input" placeholder="搜索..." aria-label="搜索">
|
||||
<button class="search-clear" aria-label="清除搜索">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<button class="fullscreen-toggle" aria-label="切换全屏模式">
|
||||
<i class="fas fa-expand"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容 -->
|
||||
<div class="main-content">
|
||||
<!-- home页 -->
|
||||
<div class="page active" id="home">
|
||||
{{{pages.home}}}
|
||||
</div>
|
||||
|
||||
<!-- 项目页 -->
|
||||
<div class="page" id="projects">
|
||||
{{{pages.projects}}}
|
||||
</div>
|
||||
|
||||
<!-- 文章页 -->
|
||||
<div class="page" id="articles">
|
||||
{{{pages.articles}}}
|
||||
</div>
|
||||
|
||||
<!-- 朋友页 -->
|
||||
<div class="page" id="friends">
|
||||
{{{pages.friends}}}
|
||||
</div>
|
||||
|
||||
<!-- 书签页 -->
|
||||
<div class="page" id="bookmarks">
|
||||
{{{pages.bookmarks}}}
|
||||
</div>
|
||||
|
||||
<!-- 搜索结果页 -->
|
||||
<div class="page" id="search-results">
|
||||
{{{pages.search-results}}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 页脚 -->
|
||||
<footer class="main-footer">
|
||||
<p>© {{currentYear}} {{site.title}} | {{site.footer}}</p>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,16 +1,7 @@
|
||||
<div class="page" id="{{pageId}}">
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{!-- page.hbs - 通用页面模板:结构与其他页面一致(标题区 + 分类内容) --}}
|
||||
<div class="page-template page-template-{{pageId}}">
|
||||
{{> page-header}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
{{#ifEquals pageId @root.homePageId}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="profile-title">{{title}}</h2>
|
||||
<h3 data-editable="profile-subtitle">{{subtitle}}</h3>
|
||||
{{!-- projects.hbs - 项目页:风格 A(代码仓库风),标题栏右侧展示 GitHub 热力图(可选) --}}
|
||||
<div class="page-template page-template-projects">
|
||||
{{> page-header}}
|
||||
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">{{title}}</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">{{subtitle}}</p>
|
||||
</div>
|
||||
{{/ifEquals}}
|
||||
{{#each categories}}
|
||||
{{> category}}
|
||||
{{/each}}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<!-- 搜索结果页 -->
|
||||
<div class="welcome-section">
|
||||
<h2 data-editable="page-title">搜索结果</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">在所有页面中找到的匹配项</p>
|
||||
<div class="welcome-section-main">
|
||||
<h2 data-editable="page-title">搜索结果</h2>
|
||||
<p class="subtitle" data-editable="page-subtitle">在所有页面中找到的匹配项</p>
|
||||
</div>
|
||||
</div>
|
||||
{{#each navigation}}
|
||||
<section class="category search-section" data-section="{{id}}" data-type="category" data-name="{{name}}" data-icon="{{icon}}" style="display: none;">
|
||||
<h2 data-editable="category-name"><i class="{{icon}}"></i> {{name}}匹配项</h2>
|
||||
<div class="sites-grid" data-container="sites"></div>
|
||||
</section>
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
|
||||
Reference in New Issue
Block a user