feat: OGP用のクラスを追加

This commit is contained in:
usbharu 2024-09-05 14:15:45 +09:00
parent df6d2940ed
commit 48d325deed
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 14 additions and 6 deletions

View File

@ -0,0 +1,8 @@
package dev.usbharu.hideout.core.interfaces.web.common
data class OGP(
val title: String,
val url: String,
val description: String,
val image: String?
)

View File

@ -2,12 +2,12 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<head prefix="og: http://ogp.me/ns#"> <head prefix="og: http://ogp.me/ns#">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title th:title="${title}">Index</title> <title th:title="${ogp.title}">Index</title>
<meta property="og:url" th:content="${url}"> <meta property="og:url" th:content="${ogp.url}">
<meta property="og:title" th:content="${title}"> <meta property="og:title" th:content="${ogp.title}">
<meta property="og:description" th:content="${description}"> <meta property="og:description" th:content="${ogp.description}">
<th:block th:if="${image != null}"> <th:block th:if="${ogp.image != null}">
<meta property="og:image" th:content="${image}"> <meta property="og:image" th:content="${ogp.image}">
</th:block> </th:block>
<noscript> <noscript>
<meta http-equiv="refresh" th:content="${'1; url='+nsUrl}"> <meta http-equiv="refresh" th:content="${'1; url='+nsUrl}">