@@ -13,7 +13,7 @@ import {
1313 getSubcategoriesByCategory ,
1414 getSubcategoryPath ,
1515} from " @/lib/posts" ;
16- import { getResourceById } from " @/lib/resources" ;
16+ import { getResourceById , getResourceBySlug } from " @/lib/resources" ;
1717import { SITE_NAME , SITE_DESCRIPTION } from " @/consts" ;
1818import { buildOrganizationSchema } from " @/lib/schema" ;
1919import { HOME_HERO , HOME_FOCUS , HOME_ISSUES , HOME_LATEST , HOME_REQUEST } from " @/data/home" ;
@@ -55,6 +55,12 @@ const focusSteps = getSubcategoriesByCategory(HOME_FOCUS.category)
5555 return { name: sub .name , href: getSubcategoryPath (sub ), link };
5656 });
5757
58+ // ツール+関連資料(resourceSlug の資料が見つからないときは資料の枠を出さない)
59+ const focusTools = HOME_FOCUS .tools .map ((tool ) => ({
60+ ... tool ,
61+ resource: tool .resourceSlug ? getResourceBySlug (tool .resourceSlug ) : undefined ,
62+ }));
63+
5864// このテーマの新着(記事・資料)
5965const focusLatest = focusItems .slice (0 , HOME_FOCUS .latestCount ).map ((item ) => ({
6066 ... item ,
@@ -149,19 +155,44 @@ const latestPosts = getLibraryItems("post")
149155
150156 <div class =" mt-10 grid gap-4 md:grid-cols-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.3fr)]" >
151157 { /* ツール */ }
152- { HOME_FOCUS . tools .map ((tool ) => (
158+ { focusTools .map ((tool ) => (
153159 <div class = " flex flex-col border border-neutral-300 bg-white p-6 md:p-7" >
154160 <p class = " text-xs font-bold text-neutral-500" >{ tool .label } </p >
155161 <h3 class = " mt-2 text-xl font-extrabold leading-snug" >
156162 <a href = { tool .cta .href } class = " hover:underline" >{ tool .name } </a >
157163 </h3 >
158164 <p class = " mt-4 text-sm leading-[1.9] text-neutral-700" >{ tool .description } </p >
159165 { tool .note && <p class = " mt-4 bg-neutral-100 p-4 text-xs leading-relaxed text-neutral-700" >{ tool .note } </p >}
160- { tool .subLink && (
161- <a href = { tool .subLink .href } class = " mt-4 inline-flex items-center gap-2 self-start text-sm font-bold hover:underline" >
162- { tool .subLink .label }
163- <span aria-hidden = " true" >→</span >
164- </a >
166+ { /* 関連資料(tools の resourceSlug。資料DBから題名・公開日・説明を表示) */ }
167+ { tool .resource && (
168+ <div class = " mt-6 grid grid-cols-[72px_minmax(0,1fr)] gap-4" >
169+ <a href = { ` /resources/${tool .resource .slug } ` } class = " block" aria-hidden = " true" tabindex = " -1" >
170+ <div class = " aspect-[3/4] w-full border border-neutral-200 bg-white p-2" >
171+ <p class = " text-[0.45rem] font-bold" >MKTG.AX</p >
172+ <div class = " mt-1 h-[2px] bg-ink-950" ></div >
173+ <p class = " mt-1.5 line-clamp-4 text-[0.55rem] font-extrabold leading-snug" >{ tool .resource .title } </p >
174+ <div class = " mt-1.5 space-y-1" aria-hidden = " true" >
175+ <div class = " h-1 bg-neutral-100" ></div >
176+ <div class = " h-1 bg-neutral-100" ></div >
177+ </div >
178+ </div >
179+ </a >
180+ <div class = " min-w-0" >
181+ <p class = " text-xs text-neutral-500" >
182+ { HOME_FOCUS .resourceTypeLabel } / { formatDate (tool .resource .publishedAt )}
183+ </p >
184+ <p class = " mt-1.5 font-extrabold leading-snug" >
185+ <a href = { ` /resources/${tool .resource .slug } ` } class = " hover:underline" >{ tool .resource .title } </a >
186+ </p >
187+ { tool .resource .description && (
188+ <p class = " mt-1.5 line-clamp-2 text-xs leading-relaxed text-neutral-600" >{ tool .resource .description } </p >
189+ )}
190+ <a href = { ` /resources/${tool .resource .slug } ` } class = " mt-2 inline-flex items-center gap-2 text-sm font-bold hover:underline" >
191+ { HOME_FOCUS .resourceCtaLabel }
192+ <span aria-hidden = " true" >→</span >
193+ </a >
194+ </div >
195+ </div >
165196 )}
166197 <div class = " mt-auto pt-6" >
167198 <a href = { tool .cta .href } class = " flex items-center justify-between gap-4 bg-ink-950 px-6 py-3.5 text-sm font-bold text-white transition-colors hover:bg-neutral-800" >
0 commit comments