Add global site name setting to render name on public pages.
This commit is contained in:
parent
eac1240437
commit
438568eeb0
28 changed files with 36 additions and 5 deletions
|
@ -49,6 +49,7 @@ const (
|
|||
|
||||
// constants contains static, constant config values required by the app.
|
||||
type constants struct {
|
||||
SiteName string `koanf:"site_name"`
|
||||
RootURL string `koanf:"root_url"`
|
||||
LogoURL string `koanf:"logo_url"`
|
||||
FaviconURL string `koanf:"favicon_url"`
|
||||
|
@ -693,6 +694,7 @@ func initHTTPServer(app *App) *echo.Echo {
|
|||
}
|
||||
srv.Renderer = &tplRenderer{
|
||||
templates: tpl,
|
||||
SiteName: app.constants.SiteName,
|
||||
RootURL: app.constants.RootURL,
|
||||
LogoURL: app.constants.LogoURL,
|
||||
FaviconURL: app.constants.FaviconURL,
|
||||
|
|
|
@ -26,6 +26,7 @@ const (
|
|||
// tplRenderer wraps a template.tplRenderer for echo.
|
||||
type tplRenderer struct {
|
||||
templates *template.Template
|
||||
SiteName string
|
||||
RootURL string
|
||||
LogoURL string
|
||||
FaviconURL string
|
||||
|
@ -35,6 +36,7 @@ type tplRenderer struct {
|
|||
// tplData is the data container that is injected
|
||||
// into public templates for accessing data.
|
||||
type tplData struct {
|
||||
SiteName string
|
||||
RootURL string
|
||||
LogoURL string
|
||||
FaviconURL string
|
||||
|
@ -85,6 +87,7 @@ var (
|
|||
// Render executes and renders a template for echo.
|
||||
func (t *tplRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
|
||||
return t.templates.ExecuteTemplate(w, name, tplData{
|
||||
SiteName: t.SiteName,
|
||||
RootURL: t.RootURL,
|
||||
LogoURL: t.LogoURL,
|
||||
FaviconURL: t.FaviconURL,
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
<template>
|
||||
<div class="items">
|
||||
<b-field :label="$t('settings.general.siteName')" label-position="on-border">
|
||||
<b-input v-model="data['app.site_name']" name="app.root_url"
|
||||
:label="$t('settings.general.siteName')" :maxlength="300" required />
|
||||
</b-field>
|
||||
|
||||
<b-field :label="$t('settings.general.rootURL')" label-position="on-border"
|
||||
:message="$t('settings.general.rootURLHelp')">
|
||||
<b-input v-model="data['app.root_url']" name="app.root_url"
|
||||
placeholder='https://listmonk.yoursite.com' :maxlength="300" />
|
||||
placeholder='https://listmonk.yoursite.com' :maxlength="300" required />
|
||||
</b-field>
|
||||
|
||||
<div class="columns">
|
||||
|
|
|
@ -383,6 +383,7 @@
|
|||
"settings.general.rootURLHelp": "URL públic de la instal·lació (sense barra inclinada).",
|
||||
"settings.general.sendOptinConfirm": "Envia opt-in de confirmació",
|
||||
"settings.general.sendOptinConfirmHelp": "Envia un correu electrònic de confirmació de l'opt-in quan els subscriptors s'inscriguin mitjançant el formulari públic o quan l'administrador els afegeixi.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nom de canal no vàlid",
|
||||
"settings.mailserver.authProtocol": "Protocol d'autenticació",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Veřejná adresa URL instalace (bez koncového lomítka).",
|
||||
"settings.general.sendOptinConfirm": "Odeslat souhlas s odběrem",
|
||||
"settings.general.sendOptinConfirmHelp": "Odeslat e-mail se souhlasem po přihlášení nebo přidání nových odběratelů na admin formuláři.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Neplatné jméno kurýra.",
|
||||
"settings.mailserver.authProtocol": "Ověřovací protokol",
|
||||
"settings.mailserver.host": "Hostitel",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Öffentliche URL der Installation (ohne Slash am Ende).",
|
||||
"settings.general.sendOptinConfirm": "Sende Opt-In Bestätigung",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Der Name des Messengers ist ungültig",
|
||||
"settings.mailserver.authProtocol": "Autentifizierungsprotokoll",
|
||||
"settings.mailserver.host": "Server",
|
||||
|
|
|
@ -383,6 +383,7 @@
|
|||
"settings.general.rootURLHelp": "Public URL of the installation (no trailing slash).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "Send an opt-in confirmation e-mail when subscribers signup via the public form or when they are added by the admin.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Invalid messenger name.",
|
||||
"settings.mailserver.authProtocol": "Auth protocol",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL pública de la instalación (sin incluir la barra final)",
|
||||
"settings.general.sendOptinConfirm": "Enviar confirmación de inscripción",
|
||||
"settings.general.sendOptinConfirmHelp": "Cuando haya una nueva subscripción mediante el formulario o la interfaz de administración, enviar un correo de confirmación al usuario.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nombre inválido de mensajero.",
|
||||
"settings.mailserver.authProtocol": "Protocolo de autenticación",
|
||||
"settings.mailserver.host": "Host/Servidor",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Public URL of the installation (no trailing slash).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "Send an opt-in confirmation e-mail when subscribers signup via the public form or when they are added by the admin.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Invalid messenger name.",
|
||||
"settings.mailserver.authProtocol": "Auth protocol",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL publique de l'installation (sans slash final)",
|
||||
"settings.general.sendOptinConfirm": "Envoyez une confirmation d'adhésion",
|
||||
"settings.general.sendOptinConfirmHelp": "Envoyer un e-mail de confirmation d'adhésion quand de nouvelles personnes s'abonnent ou sont ajoutées par l'administrateur.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nom de messagerie invalide",
|
||||
"settings.mailserver.authProtocol": "Protocole d'authentification",
|
||||
"settings.mailserver.host": "Hôte",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Public URL of the installation (no trailing slash).",
|
||||
"settings.general.sendOptinConfirm": "Jelentkezési visszaigazolás küldése ",
|
||||
"settings.general.sendOptinConfirmHelp": "Feliratkozást megerősítő e-mail küldése, amikor az előfizetők a nyilvános űrlapon keresztül regisztrálnak, vagy amikor az adminisztrátor hozzáadja őket.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Érvénytelen üzenetküldő név.",
|
||||
"settings.mailserver.authProtocol": "Auth protokoll",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL pubblico dell'installazione (senza barra obliqua finale).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nome di messaggeria non valido.",
|
||||
"settings.mailserver.authProtocol": "Protocollo di autenticazione",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "インストール先の公開URL (末尾のスラッシュは不必要).",
|
||||
"settings.general.sendOptinConfirm": "オプトインの確認を送信",
|
||||
"settings.general.sendOptinConfirmHelp": "加入者が公開フォームからサインアップしたとき、又は管理者によって追加されたときに、オプトイン確認メールを送信。",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "無効なメッセンジャー名.",
|
||||
"settings.mailserver.authProtocol": "認証プロトコル",
|
||||
"settings.mailserver.host": "ホスト",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "ഇൻസ്റ്റാളേഷന്റെ പൊതു യൂ. ആർ. എൽ (അവസാനത്തെ സ്ലാഷ് ആവശ്യമില്ല).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "സന്ദേശവാഹകന്റെ പേര് അസാധുവാണ്",
|
||||
"settings.mailserver.authProtocol": "പ്രാമാണീകരണ പ്രോട്ടോക്കോൾ",
|
||||
"settings.mailserver.host": "ഹോസ്റ്റ്",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Publieke URL van de installatie (geen trailing slash).",
|
||||
"settings.general.sendOptinConfirm": "Verzend opt-in bevestiging",
|
||||
"settings.general.sendOptinConfirmHelp": "Verzend een opt-in bevestigingsmail als abonnees inschrijven via het publieke formulier of als ze door een administrator worden toegevoegd.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Ongeldige messenger naam.",
|
||||
"settings.mailserver.authProtocol": "Authenticatieprotocol",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Publiczny URL instalacji (bez slasha na końcu)",
|
||||
"settings.general.sendOptinConfirm": "Wyślij potwierdzenie opt-in",
|
||||
"settings.general.sendOptinConfirmHelp": "Gdy nowi subskrybenci się zapiszą albo zostaną dodanie przez formularz admina wysyłaj maila opt-in z żądaniem potwierdzenia.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nieprawidłowa nazwa komunikatora.",
|
||||
"settings.mailserver.authProtocol": "Protokół autoryzacji",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL público da instalação (sem barra final).",
|
||||
"settings.general.sendOptinConfirm": "Enviar confirmação opt-in",
|
||||
"settings.general.sendOptinConfirmHelp": "Quando novo assinante se cadastrar ou for adicionado pelo admin, enviar e-mail de confirmação opt-in.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nome de mensageiro inválido.",
|
||||
"settings.mailserver.authProtocol": "Protocolo Autenticação",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL público da instalação (sem barra final).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Nome de mensageiro inválido.",
|
||||
"settings.mailserver.authProtocol": "Protocolo Autenticação",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Adresa URL publică a instalării (fără bară finală).",
|
||||
"settings.general.sendOptinConfirm": "Trimite confirmarea de înscriere",
|
||||
"settings.general.sendOptinConfirmHelp": "Trimite un e-mail de confirmare de înscriere atunci când abonații se înscriu prin formularul public sau când sunt adăugați de către administrator.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Numele mesagerului nu este valid.",
|
||||
"settings.mailserver.authProtocol": "Protocol de autentificare",
|
||||
"settings.mailserver.host": "Gazdă",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Публичный URL текущего портала (без конечного слэша).",
|
||||
"settings.general.sendOptinConfirm": "Отправьте подтверждение об отказе от участия",
|
||||
"settings.general.sendOptinConfirmHelp": "Когда новые подписчики подписываются или добавляются через форму администратора, отправьте письмо с подтверждением подписки.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Неверное имя мессенджера.",
|
||||
"settings.mailserver.authProtocol": "Протокол авторизации",
|
||||
"settings.mailserver.host": "Хост",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "Kurulumun genel URL'si (bölme çizgisi yok).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Geçersiz messenger adı.",
|
||||
"settings.mailserver.authProtocol": "Protokol",
|
||||
"settings.mailserver.host": "İstemci",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "URL công khai của cài đặt (không có dấu gạch chéo).",
|
||||
"settings.general.sendOptinConfirm": "Gửi xác nhận chọn tham gia",
|
||||
"settings.general.sendOptinConfirmHelp": "Gửi e-mail xác nhận chọn tham gia khi người đăng ký đăng ký qua biểu mẫu công khai hoặc khi họ được thêm bởi quản trị viên.",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "Tên người đưa tin không hợp lệ.",
|
||||
"settings.mailserver.authProtocol": "Giao thức xác thực",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "安装的公共 URL(没有尾部斜杠)。",
|
||||
"settings.general.sendOptinConfirm": "发送选择加入确认",
|
||||
"settings.general.sendOptinConfirmHelp": "当订阅者通过公共表单注册或由管理员添加时,发送选择加入确认电子邮件。",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "信使名称无效。",
|
||||
"settings.mailserver.authProtocol": "身份验证协议",
|
||||
"settings.mailserver.host": "主机",
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
"settings.general.rootURLHelp": "安裝的公共URL(沒有尾部斜杠)。",
|
||||
"settings.general.sendOptinConfirm": "發送選擇加入確認",
|
||||
"settings.general.sendOptinConfirmHelp": "當訂閱者通過公共表單註冊或由管理員添加時,發送選擇加入確認電子郵件。",
|
||||
"settings.general.siteName": "Site name",
|
||||
"settings.invalidMessengerName": "信使名稱無效。",
|
||||
"settings.mailserver.authProtocol": "身份驗證協議",
|
||||
"settings.mailserver.host": "主機",
|
||||
|
|
|
@ -25,13 +25,11 @@ func V2_3_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
|
|||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
// if _, err := db.Exec(`ALTER TABLE campaigns ADD COLUMN IF NOT EXISTS "publish_meta" JSONB NOT NULL DEFAULT '{}'`); err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
// Insert new preference settings.
|
||||
if _, err := db.Exec(`
|
||||
INSERT INTO settings (key, value) VALUES
|
||||
('app.site_name', '"Mailing list"'),
|
||||
('privacy.allow_preferences', 'false')
|
||||
ON CONFLICT DO NOTHING;
|
||||
`); err != nil {
|
||||
|
|
|
@ -2,6 +2,7 @@ package models
|
|||
|
||||
// Settings represents the app settings stored in the DB.
|
||||
type Settings struct {
|
||||
AppSiteName string `json:"app.site_name"`
|
||||
AppRootURL string `json:"app.root_url"`
|
||||
AppLogoURL string `json:"app.logo_url"`
|
||||
AppFaviconURL string `json:"app.favicon_url"`
|
||||
|
|
|
@ -182,6 +182,7 @@ CREATE TABLE settings (
|
|||
);
|
||||
DROP INDEX IF EXISTS idx_settings_key; CREATE INDEX idx_settings_key ON settings(key);
|
||||
INSERT INTO settings (key, value) VALUES
|
||||
('app.site_name', '"Mailing list"'),
|
||||
('app.root_url', '"http://localhost:9000"'),
|
||||
('app.favicon_url', '""'),
|
||||
('app.from_email', '"listmonk <noreply@listmonk.yoursite.com>"'),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>{{ .Data.Title }}</title>
|
||||
<title>{{ .Data.Title }} - {{ .SiteName }}</title>
|
||||
<meta name="description" content="{{ .Data.Description }}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
||||
<link href="/public/static/style.css" rel="stylesheet" type="text/css" />
|
||||
|
|
Loading…
Reference in a new issue