Browse Source

#80 画像読込の優先度

#23^2
みてるぞ 14 hours ago
parent
commit
f3bd9bea77
2 changed files with 10 additions and 1 deletions
  1. +6
    -0
      frontend/public/.htaccess
  2. +4
    -1
      frontend/src/pages/posts/PostListPage.tsx

+ 6
- 0
frontend/public/.htaccess View File

@@ -1,3 +1,9 @@
<IfModule mod_headers.c>
<FilesMatch "\.(css|js|jpg|png|webp|woff2?)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /


+ 4
- 1
frontend/src/pages/posts/PostListPage.tsx View File

@@ -94,13 +94,16 @@ export default () => {
{posts.length
? (
<div className="flex flex-wrap gap-4 gap-y-8 p-4 justify-between">
{posts.map (post => (
{posts.map ((post, i) => (
<Link to={`/posts/${ post.id }`}
key={post.id}
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg">
<img src={post.thumbnail || post.thumbnailBase || undefined}
alt={post.title || post.url}
title={post.title || post.url || undefined}
loading="eager"
fetchPriority="high"
decoding="async"
className="object-none w-full h-full" />
</Link>))}
</div>)


Loading…
Cancel
Save