seo

package module
v0.0.0-...-d904878 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 20 Imported by: 0

README

SEO

This SEO library allows for the management of and injection of dynamic data into HTML tags for the purpose of Search Engine Optimisation. Using the QOR Admin interface, an administrator can easily manage the content of an HTML page's title, description, and meta tags.

GoDoc

Documentation

https://doc.getqor.com/helpers/seo.html

License

Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MicroProductTemplate = `` /* 992-byte string literal not displayed */

	MicroContactTemplate = `` /* 273-byte string literal not displayed */

	MicroSearchTemplate = `` /* 262-byte string literal not displayed */

)
View Source
var E_SEO_COLLECTION = PREFIX + ".collection"
View Source
var PREFIX string

Functions

func ECollection

func ECollection(name string) string

Types

type Collection

type Collection struct {
	Name            string
	SettingResource *admin.Resource
	// contains filtered or unexported fields
}

Collection will hold registered seo configures and global setting definition and other configures

func New

func New(name string) *Collection

New initialize a SeoCollection instance

func (*Collection) ConfigureQorResource

func (collection *Collection) ConfigureQorResource(res resource.Resourcer)

ConfigureQorResource configure seoCollection for qor admin

func (*Collection) GetSEO

func (collection *Collection) GetSEO(name string) *SEO

GetSeo get a Seo by name

func (*Collection) RegisterGlobalVaribles

func (collection *Collection) RegisterGlobalVaribles(s interface{})

RegisterGlobalVaribles register global setting struct and will represents as 'Site-wide Settings' part in admin

func (*Collection) RegisterSEO

func (collection *Collection) RegisterSEO(seo *SEO)

RegisterSEO register a seo

func (Collection) Render

func (collection Collection) Render(context *qor.Context, name string, objects ...interface{}) template.HTML

Render render SEO Setting

func (*Collection) SEOSettingURL

func (collection *Collection) SEOSettingURL(name string) string

SEOSettingURL get setting inline edit url by name

type CollectionEvent

type CollectionEvent struct {
	plug.PluginEventInterface
	Collection     *Collection
	CollectionName string
	PluginEvent    plug.PluginEventInterface
}

type MicroContact

type MicroContact struct {
	URL         string
	Telephone   string
	ContactType string
}

MicroContact micro search definition, ref: https://developers.google.com/structured-data/customize/contact-points

func (MicroContact) Render

func (contact MicroContact) Render() template.HTML

Render render micro contact structured data

type MicroProduct

type MicroProduct struct {
	Name            string
	Image           string
	Description     string
	BrandName       string
	SKU             string
	RatingValue     float32
	ReviewCount     int
	PriceCurrency   string
	Price           float64
	PriceValidUntil string
	SellerName      string
}

MicroProduct micro product definition, ref: https://developers.google.com/structured-data/rich-snippets/products

func (MicroProduct) Render

func (product MicroProduct) Render() template.HTML

Render render micro product structured data

type MicroSearch

type MicroSearch struct {
	URL        string
	Target     string
	QueryInput string
}

MicroSearch micro search definition, ref: https://developers.google.com/structured-data/slsb-overview e.g.

Target: https://query.example-petstore.com/search?q={keyword}

func (MicroSearch) FormattedQueryInput

func (search MicroSearch) FormattedQueryInput() string

FormattedQueryInput format query input

func (MicroSearch) Render

func (search MicroSearch) Render() template.HTML

Render render micro search structured data

type Plugin

type Plugin struct {
	plug.EventDispatcher
	CollectionNames []string
}

func (*Plugin) OnRegister

func (p *Plugin) OnRegister()

func (*Plugin) RequireOptions

func (p *Plugin) RequireOptions() []string

type QorSEOSetting

type QorSEOSetting struct {
	Name        string `gorm:"primary_key"`
	Setting     Setting
	IsGlobalSEO bool

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `gorm:"index"`
	// contains filtered or unexported fields
}

QorSEOSetting default seo model

func (QorSEOSetting) GetDescription

func (s QorSEOSetting) GetDescription() string

GetDescription get Setting's description

func (QorSEOSetting) GetGlobalSetting

func (s QorSEOSetting) GetGlobalSetting() map[string]string

GetGlobalSetting get QorSeoSetting's globalSetting

func (QorSEOSetting) GetIsGlobalSEO

func (s QorSEOSetting) GetIsGlobalSEO() bool

GetIsGlobalSEO get QorSEOSetting's isGlobal

func (QorSEOSetting) GetKeywords

func (s QorSEOSetting) GetKeywords() string

GetKeywords get Setting's keywords

func (QorSEOSetting) GetName

func (s QorSEOSetting) GetName() string

GetName get QorSeoSetting's name

func (QorSEOSetting) GetSEO

func (s QorSEOSetting) GetSEO() *SEO

GetSEO get Setting's SEO configure

func (QorSEOSetting) GetSEOType

func (s QorSEOSetting) GetSEOType() string

GetSeoType get QorSeoSetting's type

func (QorSEOSetting) GetTitle

func (s QorSEOSetting) GetTitle() string

GetTitle get Setting's title

func (*QorSEOSetting) SetCollection

func (s *QorSEOSetting) SetCollection(collection *Collection)

SetCollection set Setting's collection

func (*QorSEOSetting) SetGlobalSetting

func (s *QorSEOSetting) SetGlobalSetting(globalSetting map[string]string)

SetGlobalSetting set QorSeoSetting's globalSetting

func (*QorSEOSetting) SetIsGlobalSEO

func (s *QorSEOSetting) SetIsGlobalSEO(isGlobal bool)

SetIsGlobalSEO set QorSeoSetting's isGlobal

func (*QorSEOSetting) SetName

func (s *QorSEOSetting) SetName(name string)

SetName set QorSeoSetting's name

func (*QorSEOSetting) SetSEOType

func (s *QorSEOSetting) SetSEOType(t string)

SetSeoType set QorSeoSetting's type

type QorSEOSettingInterface

type QorSEOSettingInterface interface {
	GetName() string
	SetName(string)
	GetGlobalSetting() map[string]string
	SetGlobalSetting(map[string]string)
	GetSEOType() string
	SetSEOType(string)
	GetIsGlobalSEO() bool
	SetIsGlobalSEO(bool)
	GetTitle() string
	GetDescription() string
	GetKeywords() string
	SetCollection(*Collection)
}

QorSEOSettingInterface support customize Seo model

type SEO

type SEO struct {
	Name     string
	Varibles []string
	Context  func(...interface{}) map[string]string
	// contains filtered or unexported fields
}

SEO represents a seo object for a page

type Setting

type Setting struct {
	Title            string `gorm:"size:4294967295"`
	Description      string
	Keywords         string
	Type             string
	EnabledCustomize bool
	GlobalSetting    map[string]string
}

Setting defined meta's attributes

func (Setting) ConfigureQorMetaBeforeInitialize

func (Setting) ConfigureQorMetaBeforeInitialize(meta resource.Metaor)

ConfigureQorMetaBeforeInitialize configure SEO setting for qor admin

func (*Setting) Scan

func (setting *Setting) Scan(value interface{}) error

Scan scan value from database into struct

func (Setting) Value

func (setting Setting) Value() (driver.Value, error)

Value get value from struct, and save into database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL