feat: H1 to H2 setting with the admin save conversion (tracer)
- 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)
This commit is contained in:
@@ -17,6 +17,12 @@ type Settings struct {
|
||||
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" }
|
||||
@@ -27,6 +33,7 @@ func (Settings) Fillable() []string {
|
||||
"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",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +53,8 @@ func (Settings) Rules() map[string]string {
|
||||
"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",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,21 @@ fields:
|
||||
type: switch
|
||||
default: false
|
||||
tab: golem15.journal::lang.journal.tab_general
|
||||
content_h1_to_h2:
|
||||
span: left
|
||||
label: golem15.journal::lang.journal.h1_to_h2_label
|
||||
comment: golem15.journal::lang.journal.h1_to_h2_comment
|
||||
type: switch
|
||||
default: true
|
||||
tab: golem15.journal::lang.journal.tab_headings
|
||||
generic_anchors:
|
||||
span: full
|
||||
label: golem15.journal::lang.journal.generic_anchors_label
|
||||
comment: golem15.journal::lang.journal.generic_anchors_comment
|
||||
type: textarea
|
||||
size: small
|
||||
default: "click here\nhere\nmore\nread more\nlearn more\nthis link\nlink\nkliknij tutaj\ntutaj\ntu\nwięcej\nczytaj więcej\nczytaj dalej\nten link"
|
||||
tab: golem15.journal::lang.journal.tab_headings
|
||||
search_use_typesense:
|
||||
span: left
|
||||
label: golem15.journal::lang.journal.search_use_typesense_label
|
||||
|
||||
Reference in New Issue
Block a user