<?xml version="1.0" encoding="utf-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
        
            <title type="text">Tessera 演示站</title>
        

        
            
                <subtitle type="text">记录技术、写作与生活3</subtitle>
            
        
        <updated>2026-11-15T10:00:00+08:00</updated>

        
            <id>https://guankan.tk</id>
        
        
            <link rel="alternate" type="text/html" href="https://guankan.tk"/>
            <link rel="self" type="application/atom+xml" href="https://guankan.tk/atom.xml"/>
        
        <rights>Copyright © 2026, Tessera 演示站</rights>
        <generator uri="https://go-sonic.org/" version="v1.1.4">Sonic</generator>
        
            
                <entry>
                    <title><![CDATA[Nginx 反向代理与 HTTPS 配置笔记]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/nginx-proxy-https"/>
                    <id>tag:https://guankan.tk,2026-11-15:nginx-proxy-https</id>
                    <published>2026-11-15T10:00:00+08:00</published>
                    <updated>2026-11-15T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>基础反向代理</h2><pre><code class="language-nginx">upstream blog {    server 127.0.0.1:8080;    keepalive 16;}</code></pre><h2>开启 Gzip</h2><pre><code class="language-nginx">gzip on;gzip_types text/css application/javascript application/json image/svg+xml;gzip_min_length 1024;</code></pre><h2>证书</h2><p>使用 certbot 自动申请与续期：</p><pre><code class="language-bash">certbot --nginx -d blog.example.com</code></pre><h2>检查清单</h2><ol><li>80 端口跳转 443</li><li>开启 HTTP/2</li><li>静态资源长缓存</li><li>关闭 server_tokens</li></ol><blockquote><p>配置改完后先 <code>nginx -t</code> 校验，再 reload，避免把站点弄挂。</p></blockquote>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[秋日随笔：写作是一件需要练习的事]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/autumn-writing-notes"/>
                    <id>tag:https://guankan.tk,2026-11-14:autumn-writing-notes</id>
                    <published>2026-11-14T10:00:00+08:00</published>
                    <updated>2026-11-14T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>记录的冲动</h2><p>很多想法在通勤路上出现，又在到站时消失。</p><h2>先写下来，再想清楚</h2><blockquote><p>写作不是把想清楚的东西写出来，写作本身就是想清楚的过程。</p></blockquote><h2>一个小习惯</h2><p>每天留出二十分钟，只做一件事：把当天的碎片整理成三句话。</p><h2>关于发布</h2><p>不必等到完美。文章发出去之后，才有机会被讨论、被修正。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[原生 JavaScript 实现目录跟随与图片查看]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/vanilla-js-toc-and-lightbox"/>
                    <id>tag:https://guankan.tk,2026-11-12:vanilla-js-toc-and-lightbox</id>
                    <published>2026-11-12T10:00:00+08:00</published>
                    <updated>2026-11-12T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>目录高亮的思路</h2><p>监听正文标题的可见状态，反向高亮对应的目录项。</p><pre><code class="language-js">const observer = new IntersectionObserver((entries) =&gt; {  entries.forEach((entry) =&gt; {    if (entry.isIntersecting) {      setActive(entry.target.id);    }  });}, { rootMargin: &#39;-80px 0px -70% 0px&#39; });document.querySelectorAll(&#39;article h2, article h3&#39;).forEach((h) =&gt; {  observer.observe(h);});</code></pre><h2>图片查看器</h2><p>原生 <code>&lt;dialog&gt;</code> 已经足够好用：</p><pre><code class="language-js">const dlg = document.querySelector(&#39;#lightbox&#39;);document.querySelectorAll(&#39;.post-content img&#39;).forEach((img) =&gt; {  img.addEventListener(&#39;click&#39;, () =&gt; {    dlg.querySelector(&#39;img&#39;).src = img.src;    dlg.showModal();  });});</code></pre><h2>深色模式切换</h2><pre><code class="language-js">const root = document.documentElement;root.dataset.theme = localStorage.getItem(&#39;theme&#39;) || &#39;light&#39;;</code></pre><table><thead><tr><th>能力</th><th>方案</th><th>体积</th></tr></thead><tbody><tr><td>目录高亮</td><td>IntersectionObserver</td><td>1KB</td></tr><tr><td>图片查看</td><td>dialog</td><td>2KB</td></tr><tr><td>主题切换</td><td>CSS 变量</td><td>0.5KB</td></tr></tbody></table><h2>结语</h2><p>把浏览器自带的能力用足，往往比引入一个库更划算。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[高性能博客的资源优化清单]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/blog-performance-checklist"/>
                    <id>tag:https://guankan.tk,2026-11-10:blog-performance-checklist</id>
                    <published>2026-11-10T10:00:00+08:00</published>
                    <updated>2026-11-10T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>为什么要关心性能</h2><p>个人博客的访问量不大，但页面体验直接影响阅读意愿。</p><h2>图片</h2><ul><li>使用 WebP/AVIF</li><li>按容器尺寸输出，不要用 2000px 的图做 400px 的卡片</li><li>首屏之外的图片加 <code>loading=&quot;lazy&quot;</code></li></ul><h2>字体</h2><p>优先使用系统字体栈，中文字体体积动辄数 MB：</p><pre><code class="language-css">font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;</code></pre><h2>CSS 与 JS</h2><ul><li>单文件、按需加载</li><li>关键样式内联</li><li>避免阻塞渲染的第三方脚本</li></ul><h2>缓存</h2><pre><code class="language-nginx">location ~* \.(css|js|jpg|png|woff2)$ {    expires 30d;    add_header Cache-Control &quot;public, immutable&quot;;}</code></pre><h2>清单</h2><ul><li><input checked="" disabled="" type="checkbox"> 图片懒加载</li><li><input checked="" disabled="" type="checkbox"> 静态资源长缓存</li><li><input checked="" disabled="" type="checkbox"> 去掉不必要的第三方脚本</li><li><input disabled="" type="checkbox"> 图片转 WebP</li></ul><blockquote><p>性能优化没有终点，先做收益最大的那 20%。</p></blockquote>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[Go 模板渲染机制浅析：从 text/template 到主题系统]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/go-template-render"/>
                    <id>tag:https://guankan.tk,2026-11-08:go-template-render</id>
                    <published>2026-11-08T10:00:00+08:00</published>
                    <updated>2026-11-08T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>模板的本质</h2><p>Go 的模板是「数据 + 模板 + 函数映射」三者结合的结果，渲染过程就是一次受控的求值。</p><h2>三个核心概念</h2><ul><li><code>define</code>：声明一个具名模板</li><li><code>template</code>：在当前位置插入另一个模板</li><li><code>FuncMap</code>：注册自定义函数</li></ul><pre><code class="language-go">tmpl := template.Must(template.New(&quot;index&quot;).    Funcs(funcMap).    ParseFS(fs, &quot;theme/*.tmpl&quot;))</code></pre><h2>上下文是一个 map</h2><p>主题拿到的上下文通常是 <code>map[string]interface{}</code>，所以访问不存在的键不会报错，只会输出空值。</p><pre><code class="language-html">{{ if .prevPost }}上一篇{{ end }}</code></pre><h2>安全与转义</h2><p>默认情况下所有输出都会被 HTML 转义，需要输出富文本时必须显式声明：</p><pre><code class="language-html">{{ noescape .post.Content }}</code></pre><blockquote><p>这也是主题开发中最容易踩的坑：正文被转义成一片乱码。</p></blockquote><h2>小结</h2><p>理解了模板的求值方式，读懂任何 Go 博客主题都不难。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[CSS 现代卡片布局的 10 个细节]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/css-card-layout-details"/>
                    <id>tag:https://guankan.tk,2026-11-06:css-card-layout-details</id>
                    <published>2026-11-06T10:00:00+08:00</published>
                    <updated>2026-11-06T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>从一张卡片开始</h2><p>卡片的质感来自细节的叠加，而不是某一个夸张的效果。</p><h3>1. 统一圆角</h3><pre><code class="language-css">:root {  --radius-card: 14px;  --radius-thumb: 10px;}</code></pre><h3>2. 克制的阴影</h3><p>阴影只用来表达层级，不要用来装饰。</p><h3>3. 悬停只做微位移</h3><pre><code class="language-css">.card:hover {  transform: translateY(-3px);  box-shadow: 0 12px 28px rgba(15, 23, 42, .08);}</code></pre><h3>4. 图片固定比例</h3><p>用 <code>aspect-ratio</code> 保证卡片高度一致，避免瀑布流式的参差。</p><h2>信息截断</h2><p>标题最多两行，摘要最多三行：</p><pre><code class="language-css">.clamp-2 {  display: -webkit-box;  -webkit-line-clamp: 2;  -webkit-box-orient: vertical;  overflow: hidden;}</code></pre><h2>移动端的处理</h2><ul><li>卡片改为单列</li><li>图片比例从 16:9 调整为 3:2</li><li>元信息只保留时间与分类</li></ul><table><thead><tr><th>断点</th><th>列数</th><th>图片比例</th></tr></thead><tbody><tr><td>&lt; 640px</td><td>1</td><td>3:2</td></tr><tr><td>640-1024px</td><td>2</td><td>16:9</td></tr><tr><td>&gt; 1024px</td><td>2-3</td><td>16:9</td></tr></tbody></table><h2>总结</h2><p>细节一致，整体就会显得专业。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[Tessera 主题设计思路：卡片式布局的取舍]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/tessera-design-notes"/>
                    <id>tag:https://guankan.tk,2026-11-04:tessera-design-notes</id>
                    <published>2026-11-04T10:00:00+08:00</published>
                    <updated>2026-11-04T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>设计目标</h2><p>Tessera 的定位是「专业博客 + 资源分享」，需要在信息密度和阅读舒适度之间取得平衡。</p><h3>三栏信息的优先级</h3><ol><li>封面图：承担第一眼的吸引力</li><li>标题：决定是否点击</li><li>元信息：分类、时间、作者、标签</li></ol><h2>关于栅格</h2><p>主内容区采用 12 栅格，文章列表在桌面端每行 2 张卡片，宽屏可以到 3 张。</p><pre><code class="language-css">.post-grid {  display: grid;  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));  gap: 24px;}</code></pre><h2>为什么不用框架</h2><p>主题最终要部署到用户的服务器上，每多一个依赖就多一份加载成本和维护负担。</p><ul><li>原生 CSS 变量即可实现深浅色</li><li>原生 JavaScript 足以处理目录、搜索、切换</li><li>首屏不需要任何第三方运行时</li></ul><h2>留白的尺度</h2><blockquote><p>卡片间距 24px，卡片内边距 20px，标题与摘要之间 10px —— 这组数值在 1440px 和 390px 下都不会显得拥挤。</p></blockquote><h2>后续计划</h2><p>继续打磨文章页的阅读体验，包括目录跟随、代码块复制和图片查看。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[用 Sonic 搭建个人博客：从零到上线的完整实践]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/build-blog-with-sonic"/>
                    <id>tag:https://guankan.tk,2026-11-02:build-blog-with-sonic</id>
                    <published>2026-11-02T10:00:00+08:00</published>
                    <updated>2026-11-02T10:00:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2 id="%E4%B8%BA%E4%BB%80%E4%B9%88%E9%80%89%E6%8B%A9-sonic" tabindex="-1">为什么选择 Sonic</h2><p>Sonic 是一个用 Go 编写的轻量级博客程序，二进制单文件部署，内置 SQLite 支持，对个人服务器非常友好。</p><p>相比 WordPress，它的资源占用低得多；相比静态博客，它又保留了后台管理、评论、搜索等动态能力。</p><h2 id="%E9%83%A8%E7%BD%B2%E5%89%8D%E7%9A%84%E5%87%86%E5%A4%87" tabindex="-1">部署前的准备</h2><p>一台 1 核 1G 的云服务器就足够跑起来，建议准备好：</p><ul><li>一个可解析的域名</li><li>服务器 80/443 端口</li><li>一份 Nginx 配置</li></ul><h2 id="%E5%90%AF%E5%8A%A8%E7%A8%8B%E5%BA%8F" tabindex="-1">启动程序</h2><p>下载对应平台的压缩包，解压后直接运行：</p><pre><code class="language-bash">cd /opt/sonic./sonic --config=conf/config.yaml</code></pre><p>首次启动会自动创建 SQLite 数据库并完成初始化，随后访问 <code>/admin</code> 完成安装向导。</p><pre><code class="language-">&lt;script&gt;  // 公告  (function() {    new Marquee({      // 要滚动的元素      elem: document.getElementById(&quot;marquee2&quot;),      // 每次滚动的步长(px)，默认0      step: 30,      // 滚动效果执行时间(ms)，默认400      stepInterval: 400,      // 每次滚动间隔时间(ms)，默认3000      interval: 3000,      // 滚动方向，up、down、left、right，默认为&quot;left&quot; 当前只支持上下      dir: &#39;up&#39;,      // 是否自动滚动，默认为true      autoPlay: true,      // 是否在鼠标滑过低级元素时暂停滚动，默认为true      hoverPause: true    });  })();  // 上传控制  $(&#39;#upShowID&#39;).uploader({    // 自动上传    autoUpload: false,    // 文件上传提交地址    url: &#39;./app/upload.php&#39;,    // 最大支持的上传文件    max_file_size: &lt;?php echo $config[&#39;maxSize&#39;]; ?&gt;,    // 分片上传 0为不分片 分片容易使图片上传失败    chunk_size: &lt;?php echo $config[&#39;chunks&#39;]; ?&gt;,    // 点击文件列表上传文件    browseByClickList: true,    // flash 上传组件地址    flash_swf_url: &#39;&lt;?php static_cdn(); ?&gt;/public/static/zui/lib/uploader/Moxie.swf&#39;,    // silverlight 上传组件地址    flash_swf_url: &#39;&lt;?php static_cdn(); ?&gt;/public/static/zui/lib/uploader/Moxie.xap&#39;,    // sign    multipart_params: {      &#39;sign&#39;: new Date().getTime() / 1000 | 0,    },    // 预览图尺寸    previewImageSize: {      &#39;width&#39;: 80,      &#39;height&#39;: 80    },    // 上传格式过滤    filters: { // 只允许上传图片或图标（.ico）      mime_types: [{          title: &#39;图片&#39;,          extensions: &#39;&lt;?php echo $config[&#39;extensions&#39;]; ?&gt;&#39;        },        {          title: &#39;图标&#39;,          extensions: &#39;ico&#39;        }      ],      prevent_duplicates: true    },    // 限制文件上传数目    limitFilesCount: &lt;?php echo $config[&#39;maxUploadFiles&#39;]; ?&gt;,    // 移除文件进行确认    deleteConfirm: true,    // 重置上传失败的文件    autoResetFails: true,    // 当文件上传进度发送变化时触发，此回调函数会在上传文件的过程中反复触发    onUploadProgress: function(file) {      NProgress.configure({        barColor: &#39;&lt;?php echo $config[&#39;NProgress_Progress&#39;]; ?&gt;&#39;      });      NProgress.set(0)      NProgress.set(file.percent / 100)    },    // 显示上传成功消息    uploadedMessage: &#39;已上传 {uploaded} 个文件，{failed} 个文件上传失败&#39;,    // 当启用分片上传选项后，每个文件片段上传完成时触发    onChunkUploaded: function(file, responseObject) {      NProgress.set(responseObject.offset / responseObject.total);    },    &lt;?php echo imgRatio(); ?&gt;,    responseHandler: function(responseObject, file) {      var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象      console.log(file); // 输出上传log      console.log(obj); // 输出回传log      if (obj.code === 200) {        $(&quot;#links&quot;).append(obj.url + &quot;\r\n&quot;);        $(&quot;#bbscode&quot;).append(&quot;[img]&quot; + obj.url + &quot;[/img]\r\n&quot;);        $(&quot;#markdown&quot;).append(&quot;![&quot; + obj.srcName + &quot;](&quot; + obj.url + &quot;)\r\n&quot;);        $(&quot;#html&quot;).append(&#39;&amp;lt;img src=&quot;&#39; + obj.url + &#39;&quot; alt=&quot;&#39; + obj.srcName + &#39;&quot; /&amp;gt;\r\n&#39;);        $(&quot;#thumb&quot;).append(obj.thumb + &quot;\r\n&quot;);        $(&quot;#del&quot;).append(obj.del + &quot;\r\n&quot;);        // 上传成功提示        new $.zui.Messager(obj.srcName + &quot; 上传成功&quot;, {          type: &quot;primary&quot;,          placement: &#39;bottom-right&#39;,          icon: &quot;check&quot;        }).show();        try { // 储存上传历史          console.log(&#39;history localStorage success&#39;);          $.zui.store.set(obj.srcName, obj)        } catch (err) {          // 失败提示          $.zui.messager.show(&#39;存储上传记录失败&#39; + err, {            icon: &#39;bell&#39;,            time: 4000,            type: &#39;danger&#39;,            placement: &#39;top&#39;          });          console.log(&#39;localStorage failed:&#39; + err);        }      } else {        // 上传失败提示        new $.zui.Messager(obj.message, {          type: &quot;danger&quot;,          placement: &#39;bottom-right&#39;,          icon: &quot;times&quot;        }).show();        return;      }    },  });&lt;/script&gt;</code></pre><h2 id="%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E9%85%8D%E7%BD%AE" tabindex="-1">反向代理配置</h2><pre><code class="language-nginx">server {    listen 80;    server_name blog.example.com;    location / {        proxy_pass http://127.0.0.1:8080;        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;    }}</code></pre><h2 id="%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98" tabindex="-1">常见问题</h2><table><thead><tr><th>现象</th><th>原因</th><th>处理方式</th></tr></thead><tbody><tr><td>后台打不开</td><td>未完成安装</td><td>访问 /admin 走安装向导</td></tr><tr><td>图片 404</td><td>上传目录权限</td><td>检查 upload 目录可写</td></tr><tr><td>样式丢失</td><td>静态资源路径</td><td>检查主题 theme_base</td></tr></tbody></table><blockquote><p>部署过程中最容易忽略的是上传目录的写权限，容器化部署时尤其要注意挂载。</p></blockquote><h2 id="%E5%B0%8F%E7%BB%93" tabindex="-1">小结</h2><p>整套流程走下来，从下载到上线大约 20 分钟，后续只需要专注于写作本身。</p>]]>
                        
                    </content>
                </entry>
            
                <entry>
                    <title><![CDATA[Hello Sonic]]></title>
                    <link rel="alternate" type="text/html"
                          href="/archives/hello-sonic"/>
                    <id>tag:https://guankan.tk,2026-10-02:hello-sonic</id>
                    <published>2026-10-02T09:30:00+08:00</published>
                    <updated>2026-10-02T09:30:00+08:00</updated>
                    <author>
                        <name>站长</name>
                        <uri>https://guankan.tk</uri>
                    </author>
                    <content type="html">
                        
                            <![CDATA[<h2>Hello Sonic</h2><p>如果你看到了这一篇文章，那么证明你已经安装成功了，感谢使用 <a href="https://github.com/go-sonic">Sonic</a> 进行创作，希望能够使用愉快。</p><h2>相关链接</h2><ul><li>官网：<a href="https://github.com/go-sonic">https://github.com/go-sonic</a></li><li>主题仓库：<a href="https://github.com/go-sonic/default-theme-anatole">https://github.com/go-sonic/default-theme-anatole</a></li><li>开源地址：<a href="https://github.com/go-sonic/sonic">https://github.com/go-sonic/sonic</a></li></ul><p>在使用过程中，有任何问题都可以通过以上链接找寻答案，或者联系我们。</p><blockquote><p>这是一篇自动生成的文章，请删除这篇文章之后开始你的创作吧！</p></blockquote>]]>
                        
                    </content>
                </entry>
            
        
    </feed>
