- content_h1_to_h2 and generic_anchors on the settings row (migration
202610280001), Headings and links tab, config key
golem15.journal.content_h1_to_h2 used when no settings row exists
- classes.ConvertH1 on the x/net/html tokenizer; the Blog Editor types
convert while the setting is on and answer editor.h1_converted
- GET /posts/{slug} reports content_h1_to_h2 (additive key)
64 lines
2.7 KiB
Go
64 lines
2.7 KiB
Go
package models
|
|
|
|
// Settings is the singleton journal settings row (ID=1) on golem15_journal_settings.
|
|
type Settings struct {
|
|
ID uint `gorm:"column:id;primaryKey"`
|
|
ShowAllPosts bool `gorm:"column:show_all_posts"`
|
|
UseRichEditor bool `gorm:"column:use_rich_editor"`
|
|
SearchUseTypesense bool `gorm:"column:search_use_typesense"`
|
|
SearchTitleWeight int `gorm:"column:search_title_weight"`
|
|
SearchExcerptWeight int `gorm:"column:search_excerpt_weight"`
|
|
SearchContentWeight int `gorm:"column:search_content_weight"`
|
|
RSSEnabled bool `gorm:"column:rss_enabled"`
|
|
RSSIncludeContent bool `gorm:"column:rss_include_content"`
|
|
RSSTitle *string `gorm:"column:rss_title"`
|
|
RSSDescription *string `gorm:"column:rss_description"`
|
|
RSSLanguage string `gorm:"column:rss_language"`
|
|
RSSCopyright *string `gorm:"column:rss_copyright"`
|
|
RSSImageURL *string `gorm:"column:rss_image_url"`
|
|
RSSPostsPerFeed int `gorm:"column:rss_posts_per_feed"`
|
|
// ContentH1ToH2 turns H1 in Journal rich text (post content and
|
|
// category pillar text) into H2 on every write path.
|
|
ContentH1ToH2 bool `gorm:"column:content_h1_to_h2"`
|
|
// GenericAnchors lists the link texts the editor warns about, one per
|
|
// line; nil means the built-in lists.
|
|
GenericAnchors *string `gorm:"column:generic_anchors"`
|
|
}
|
|
|
|
func (Settings) TableName() string { return "golem15_journal_settings" }
|
|
|
|
func (Settings) Fillable() []string {
|
|
return []string{
|
|
"show_all_posts", "use_rich_editor", "search_use_typesense",
|
|
"search_title_weight", "search_excerpt_weight", "search_content_weight",
|
|
"rss_enabled", "rss_include_content", "rss_title", "rss_description",
|
|
"rss_language", "rss_copyright", "rss_image_url", "rss_posts_per_feed",
|
|
"content_h1_to_h2", "generic_anchors",
|
|
}
|
|
}
|
|
|
|
func (Settings) Rules() map[string]string {
|
|
return map[string]string{
|
|
"show_all_posts": "boolean",
|
|
"use_rich_editor": "boolean",
|
|
"search_use_typesense": "boolean",
|
|
"search_title_weight": "nullable|integer|min:0|max:100",
|
|
"search_excerpt_weight": "nullable|integer|min:0|max:100",
|
|
"search_content_weight": "nullable|integer|min:0|max:100",
|
|
"rss_enabled": "boolean",
|
|
"rss_include_content": "boolean",
|
|
"rss_title": "nullable|string|max:255",
|
|
"rss_description": "nullable|string|max:1000",
|
|
"rss_language": "nullable|string|max:10",
|
|
"rss_copyright": "nullable|string|max:255",
|
|
"rss_image_url": "nullable|url|max:500",
|
|
"rss_posts_per_feed": "nullable|integer|min:1|max:100",
|
|
"content_h1_to_h2": "boolean",
|
|
"generic_anchors": "nullable|string|max:5000",
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
Register(Settings{})
|
|
}
|