Skip to content

Commit

Permalink
Merge pull request #174 from Shikkanime/dev
Browse files Browse the repository at this point in the history
Add google site verification
  • Loading branch information
Ziedelth authored Feb 12, 2024
2 parents 4368014 + cfd5b1d commit 29b8d57
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ enum class ConfigPropertyKey(val key: String) {
SEO_DESCRIPTION("seo_description"),
SOCIAL_NETWORK_EPISODES_SIZE_LIMIT("social_network_episodes_size_limit"),
FETCH_OLD_EPISODE_DESCRIPTION_SIZE("fetch_old_episode_description_size"),
GOOGLE_SITE_VERIFICATION_ID("google_site_verification_id"),
}
1 change: 1 addition & 0 deletions src/main/kotlin/fr/shikkanime/plugins/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ private suspend fun handleTemplateResponse(call: ApplicationCall, controller: An
val title = map["title"] as String?
modelMap["title"] = if (title?.contains(Constant.NAME) == true) title else (if (!title.isNullOrBlank()) "$title - " else "") + Constant.NAME
modelMap["description"] = configCacheService.getValueAsString(ConfigPropertyKey.SEO_DESCRIPTION) ?: ""
configCacheService.getValueAsString(ConfigPropertyKey.GOOGLE_SITE_VERIFICATION_ID)?.let { modelMap["googleSiteVerification"] = it }

call.respond(FreeMarkerContent(map["template"] as String, modelMap, "", response.contentType))
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/db/changelog/2024/02/06-changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.25.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
<property global="false" name="id" value="1707771398324"/>
<property global="false" name="author" value="Ziedelth"/>

<changeSet id="${id}-1" author="${author}" dbms="postgresql">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*)
FROM config
WHERE property_key = 'google_site_verification_id'</sqlCheck>
</preConditions>

<insert tableName="config">
<column name="uuid" valueComputed="gen_random_uuid()"/>
<column name="property_key" value="google_site_verification_id"/>
<column name="property_value" value=""/>
</insert>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/db/changelog/db.changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
<include file="/db/changelog/2024/02/03-changelog.xml"/>
<include file="/db/changelog/2024/02/04-changelog.xml"/>
<include file="/db/changelog/2024/02/05-changelog.xml"/>
<include file="/db/changelog/2024/02/06-changelog.xml"/>
</databaseChangeLog>
3 changes: 2 additions & 1 deletion src/main/resources/templates/_freemarker_implicit.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
[#-- @ftlvariable name="originalSize" type="java.lang.String" --]
[#-- @ftlvariable name="compressedSize" type="java.lang.String" --]
[#-- @ftlvariable name="simulcasts" type="kotlin.collections.AbstractList<fr.shikkanime.dtos.SimulcastDto>" --]
[#-- @ftlvariable name="currentSimulcast" type="fr.shikkanime.dtos.SimulcastDto" --]
[#-- @ftlvariable name="currentSimulcast" type="fr.shikkanime.dtos.SimulcastDto" --]
[#-- @ftlvariable name="googleSiteVerification" type="java.lang.String" --]
6 changes: 5 additions & 1 deletion src/main/resources/templates/site/_layout.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
<title>Shikkanime</title>
</#if>

<#if description??>
<#if description?? && description?length != 0>
<meta name="description" content="${description}">
</#if>

<#if googleSiteVerification?? && googleSiteVerification?length != 0>
<meta name="google-site-verification" content="${googleSiteVerification}" />
</#if>

<#-- Favicons -->
<link rel="icon" type="image/png" sizes="64x64" href="/assets/img/favicons/favicon-64x64.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicons/favicon-32x32.png">
Expand Down

0 comments on commit 29b8d57

Please sign in to comment.