v_seo.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package seo
  2. import (
  3. "context"
  4. h "github.com/theplant/htmlgo"
  5. )
  6. type VSeoBuilder struct {
  7. tag *h.HTMLTagBuilder
  8. }
  9. func VSeo(children ...h.HTMLComponent) (r *VSeoBuilder) {
  10. r = &VSeoBuilder{
  11. tag: h.Tag("v-seo").Children(children...),
  12. }
  13. return
  14. }
  15. func (b *VSeoBuilder) Value(v string) (r *VSeoBuilder) {
  16. b.tag.Attr(":value", h.JSONString(v))
  17. return b
  18. }
  19. func (b *VSeoBuilder) Placeholder(v string) (r *VSeoBuilder) {
  20. b.tag.Attr(":placeholder", h.JSONString(v))
  21. return b
  22. }
  23. func (b *VSeoBuilder) SetAttr(k string, v interface{}) {
  24. b.tag.SetAttr(k, v)
  25. }
  26. func (b *VSeoBuilder) Attr(vs ...interface{}) (r *VSeoBuilder) {
  27. b.tag.Attr(vs...)
  28. return b
  29. }
  30. func (b *VSeoBuilder) Children(children ...h.HTMLComponent) (r *VSeoBuilder) {
  31. b.tag.Children(children...)
  32. return b
  33. }
  34. func (b *VSeoBuilder) AppendChildren(children ...h.HTMLComponent) (r *VSeoBuilder) {
  35. b.tag.AppendChildren(children...)
  36. return b
  37. }
  38. func (b *VSeoBuilder) PrependChildren(children ...h.HTMLComponent) (r *VSeoBuilder) {
  39. b.tag.PrependChildren(children...)
  40. return b
  41. }
  42. func (b *VSeoBuilder) Class(names ...string) (r *VSeoBuilder) {
  43. b.tag.Class(names...)
  44. return b
  45. }
  46. func (b *VSeoBuilder) ClassIf(name string, add bool) (r *VSeoBuilder) {
  47. b.tag.ClassIf(name, add)
  48. return b
  49. }
  50. func (b *VSeoBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  51. return b.tag.MarshalHTML(ctx)
  52. }