today_ai_weather/app/views/sitemaps/index.html.erb
songtianlun 3ae870047a feat: add sitemap management feature
- Implement index action to list sitemaps
- Create view for displaying sitemaps with details
- Add helper method for generating sitemap URLs
- Enhance error handling for S3 service errors

This commit introduces a new feature for managing sitemaps in the application. It includes an index view that lists all available sitemaps with their last modified date and size, along with a link to view each sitemap. The error handling for S3 interactions has also been improved to log errors and return appropriate responses.
2025-02-24 17:28:21 +08:00

43 lines
1.4 KiB
Plaintext

<%# app/views/sitemaps/index.html.erb %>
<div class="container mx-auto px-4 py-8">
<div class="max-w-4xl mx-auto">
<h1 class="text-3xl font-bold mb-6">Sitemaps Index</h1>
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="overflow-x-auto">
<table class="table w-full">
<thead>
<tr>
<th>Filename</th>
<th>Last Modified</th>
<th>Size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @sitemaps.each do |sitemap| %>
<tr class="hover">
<td><%= sitemap[:key] %></td>
<td><%= sitemap[:last_modified].strftime("%Y-%m-%d %H:%M:%S") %></td>
<td><%= number_to_human_size(sitemap[:size]) %></td>
<td>
<%= link_to "View", sitemap[:url],
class: "btn btn-sm btn-primary",
target: "_blank" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="mt-6 bg-base-200 p-4 rounded-lg">
<h2 class="text-xl font-semibold mb-2">For Search Engines</h2>
<p class="mb-2">Sitemap Index URL:</p>
<code class="block bg-base-300 p-2 rounded">
<%= sitemaps_url(format: :xml) %>
</code>
</div>
</div>
</div>