meta_data.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package fetdata
  2. import (
  3. "golang-fave/utils"
  4. )
  5. func (this *FERData) MetaTitle() string {
  6. if this.dataRow != nil {
  7. if this.wrap.CurrModule == "index" {
  8. return this.dataRow.(*utils.MySql_page).A_meta_title
  9. } else if this.wrap.CurrModule == "blog" {
  10. if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
  11. // Blog category
  12. return ""
  13. } else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
  14. // Blog post
  15. return ""
  16. } else {
  17. // Blog
  18. return ""
  19. }
  20. }
  21. }
  22. return ""
  23. }
  24. func (this *FERData) MetaKeywords() string {
  25. if this.dataRow != nil {
  26. if this.wrap.CurrModule == "index" {
  27. return this.dataRow.(*utils.MySql_page).A_meta_keywords
  28. } else if this.wrap.CurrModule == "blog" {
  29. if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
  30. // Blog category
  31. return ""
  32. } else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
  33. // Blog post
  34. return ""
  35. } else {
  36. // Blog
  37. return ""
  38. }
  39. }
  40. }
  41. return ""
  42. }
  43. func (this *FERData) MetaDescription() string {
  44. if this.dataRow != nil {
  45. if this.wrap.CurrModule == "index" {
  46. return this.dataRow.(*utils.MySql_page).A_meta_description
  47. } else if this.wrap.CurrModule == "blog" {
  48. if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] == "category" {
  49. // Blog category
  50. return ""
  51. } else if len(this.wrap.UrlArgs) >= 2 && this.wrap.UrlArgs[0] == "blog" && this.wrap.UrlArgs[1] != "" {
  52. // Blog post
  53. return ""
  54. } else {
  55. // Blog
  56. return ""
  57. }
  58. }
  59. }
  60. return ""
  61. }