<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>静态站点 on OHTLY Blog</title>
    <link>https://blog.ohtly.com/tags/%E9%9D%99%E6%80%81%E7%AB%99%E7%82%B9/</link>
    <description>Recent content in 静态站点 on OHTLY Blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sat, 25 Jul 2026 01:06:29 +0800</lastBuildDate>
    <atom:link href="https://blog.ohtly.com/tags/%E9%9D%99%E6%80%81%E7%AB%99%E7%82%B9/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>用 Astro &#43; Tailwind 搭建企业官网实践</title>
      <link>https://blog.ohtly.com/posts/2026-07-24-astro-tailwind-company-website/</link>
      <pubDate>Fri, 24 Jul 2026 17:50:00 +0800</pubDate>
      <guid>https://blog.ohtly.com/posts/2026-07-24-astro-tailwind-company-website/</guid>
      <description>&lt;h2 id=&#34;背景&#34;&gt;&#xA;  背景&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e8%83%8c%e6%99%af&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;链接到标题&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;链接到标题&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;原有站点基于传统 CMS，内容管理成本高，改动一次需要走完整的发布流程。业务方希望站点更轻、更稳、更容易维护，最终决定重构为纯静态站点。&lt;/p&gt;&#xA;&lt;h2 id=&#34;技术选型&#34;&gt;&#xA;  技术选型&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e6%8a%80%e6%9c%af%e9%80%89%e5%9e%8b&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;链接到标题&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;链接到标题&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;最终选用 Astro 7 + Tailwind 3，&lt;code&gt;output: &amp;quot;static&amp;quot;&lt;/code&gt;，输出纯静态文件，零客户端 JS，部署到对象存储 + CDN。&lt;/p&gt;&#xA;&lt;p&gt;选择理由：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Astro 的 Islands 架构默认不输出 JS，适合以内容为主的官网&lt;/li&gt;&#xA;&lt;li&gt;Tailwind 3 的 JIT 模式可以快速迭代 UI，无需手写大量 CSS&lt;/li&gt;&#xA;&lt;li&gt;静态产物可直接托管到任何对象存储，成本低、访问快&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;目录结构与路由&#34;&gt;&#xA;  目录结构与路由&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e7%9b%ae%e5%bd%95%e7%bb%93%e6%9e%84%e4%b8%8e%e8%b7%af%e7%94%b1&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;链接到标题&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;链接到标题&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;src/&#xA;  pages/&#xA;    index.astro          # 首页&#xA;    about.astro          # 关于&#xA;    contact.astro        # 联系&#xA;    services/&#xA;      index.astro        # 服务列表&#xA;      [slug].astro       # 服务详情（动态路由）&#xA;    404.astro            # 自定义 404&#xA;  layouts/&#xA;    BaseLayout.astro     # 全局布局&#xA;  components/&#xA;    SiteNav.astro        # 导航&#xA;    Hero.astro           # 首屏&#xA;    ServiceCard.astro    # 服务卡片&#xA;    SiteFooter.astro     # 页脚&#xA;  data/&#xA;    services.ts          # 服务数据&#xA;  styles/&#xA;    global.css           # 全局样式 + 自定义工具类&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;关键设计：服务数据集中存放在 &lt;code&gt;services.ts&lt;/code&gt;，&lt;code&gt;[slug].astro&lt;/code&gt; 通过 &lt;code&gt;getStaticPaths&lt;/code&gt; 自动生成静态页面，新增服务只需改数据文件，无需新增路由。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
