_alias.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <PodcastArticle :podcastItem="podcastItem" :filteredPodcasts="filteredPodcasts" />
  3. </template>
  4. <script>
  5. import { mapGetters } from "vuex";
  6. export default {
  7. async fetch({ store, route, error }) {
  8. await store.dispatch("modules/news/setNewsItem", route.params);
  9. await store.dispatch("modules/news/setCategoryNewsList", {
  10. category: route.params.category,
  11. page: 1
  12. });
  13. const newsItem = store.getters['modules/news/newsItem'];
  14. if(!newsItem){
  15. error({ statusCode: 404 })
  16. }
  17. },
  18. async asyncData({ req, route }) {
  19. const host = req ? req.headers.host : window.location.origin;
  20. const url = host + route.path;
  21. return { url };
  22. },
  23. computed: {
  24. ...mapGetters({
  25. podcastItem: "modules/news/newsItem",
  26. podcasts: "modules/news/categoryNewsList"
  27. }),
  28. filteredPodcasts() {
  29. return this.podcasts.news
  30. .filter(podcast => podcast.id != this.podcastItem.id)
  31. .slice(0, 3);
  32. },
  33. },
  34. head() {
  35. return {
  36. title: this.podcastItem.title,
  37. meta: [
  38. {
  39. name: "copyright",
  40. content: "ИА Амител",
  41. },
  42. {
  43. name: "publisher",
  44. content: "https://g.page/amitel?gm",
  45. },
  46. {
  47. name: "description",
  48. content: this.podcastItem.description ? this.podcastItem.description : '',
  49. },
  50. {
  51. name: "keys",
  52. content: this.podcastItem.meta.key ? this.podcastItem.meta.key : '',
  53. },
  54. {
  55. hid: "twitter:title",
  56. name: "twitter:title",
  57. content: this.podcastItem.title
  58. },
  59. {
  60. name: "author",
  61. content: this.podcastItem.show_author ? this.podcastItem.author ? this.podcastItem.author.name : 'ИА Амител' : "ИА Амител",
  62. },
  63. {
  64. name: "mediator_author",
  65. content: "ИА Амител",
  66. },
  67. {
  68. hid: "twitter:description",
  69. name: "twitter:description",
  70. content: this.podcastItem.description
  71. },
  72. {
  73. hid: "twitter:image",
  74. name: "twitter:image",
  75. content: this.podcastItem.image ? this.podcastItem.image.url : ""
  76. },
  77. {
  78. hid: "twitter:image:alt",
  79. name: "twitter:image:alt",
  80. content: this.podcastItem.image ? this.podcastItem.image.title : ""
  81. },
  82. {
  83. hid: "og:title",
  84. property: "og:title",
  85. content: this.podcastItem.title
  86. },
  87. {
  88. hid: "og:description",
  89. property: "og:description",
  90. content: this.podcastItem.description
  91. },
  92. {
  93. hid: "og:image",
  94. property: "og:image",
  95. content: this.podcastItem.image ? this.podcastItem.image.url : ""
  96. },
  97. {
  98. hid: "og:image:secure_url",
  99. property: "og:image:secure_url",
  100. content: this.podcastItem.image ? this.podcastItem.image.url : ""
  101. },
  102. {
  103. hid: "og:image:alt",
  104. property: "og:image:alt",
  105. content: this.podcastItem.image ? this.podcastItem.image.title : ""
  106. },
  107. {
  108. hid: "og:type",
  109. property: "og:type",
  110. content: "website"
  111. },
  112. {
  113. hid: "og:site_name",
  114. property: "og:site_name",
  115. content: "amic"
  116. },
  117. {
  118. hid: "og:url",
  119. property: "og:url",
  120. content: this.url
  121. },
  122. {
  123. hid: "fb:app_id",
  124. property: "fb:app_id",
  125. content: "4369125136471767"
  126. }
  127. ],
  128. link: [
  129. {rel: 'canonical', href: this.podcastItem.category ? 'https://www.amic.ru/podcasts/' + this.podcastItem.category.alias + '/' + this.podcastItem.alias : ''}
  130. ],
  131. };
  132. }
  133. };
  134. </script>
  135. <style lang="less" scoped>
  136. </style>