html2text filter for description in meta
This commit is contained in:
@@ -41,8 +41,7 @@
|
|||||||
|
|
||||||
el-menu-item(@click='showEmbed=true') <i class='el-icon-copy-document'></i> {{$t('common.embed')}}
|
el-menu-item(@click='showEmbed=true') <i class='el-icon-copy-document'></i> {{$t('common.embed')}}
|
||||||
|
|
||||||
//- TODO (ics of recurrent events)
|
el-menu-item
|
||||||
el-menu-item(v-if='!event.recurrent')
|
|
||||||
a(:href='`${settings.baseurl}/api/event/${event.id}.ics`') <i class='el-icon-date'></i> {{$t('common.add_to_calendar')}}
|
a(:href='`${settings.baseurl}/api/event/${event.id}.ics`') <i class='el-icon-date'></i> {{$t('common.add_to_calendar')}}
|
||||||
EventAdmin(v-if='is_mine' :event='event')
|
EventAdmin(v-if='is_mine' :event='event')
|
||||||
|
|
||||||
@@ -93,8 +92,8 @@ import EventAdmin from './eventAdmin'
|
|||||||
import EmbedEvent from './embedEvent'
|
import EmbedEvent from './embedEvent'
|
||||||
import FollowMe from '../../components/FollowMe'
|
import FollowMe from '../../components/FollowMe'
|
||||||
import { Message, MessageBox } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
|
|
||||||
import moment from 'moment-timezone'
|
import moment from 'moment-timezone'
|
||||||
|
const htmlToText = require('html-to-text')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Event',
|
name: 'Event',
|
||||||
@@ -140,12 +139,12 @@ export default {
|
|||||||
{
|
{
|
||||||
hid: 'description',
|
hid: 'description',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
content: this.event.description.replace('\n', '').slice(0, 1000)
|
content: this.plainDescription
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hid: 'og-description',
|
hid: 'og-description',
|
||||||
name: 'og:description',
|
name: 'og:description',
|
||||||
content: this.event.description.replace('\n', '').slice(0, 100)
|
content: this.plainDescription
|
||||||
},
|
},
|
||||||
{ hid: 'og-title', property: 'og:title', content: this.event.title },
|
{ hid: 'og-title', property: 'og:title', content: this.event.title },
|
||||||
{
|
{
|
||||||
@@ -176,7 +175,7 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'twitter:description',
|
property: 'twitter:description',
|
||||||
content: this.event.description.replace('\n', '').slice(0, 100)
|
content: this.plainDescription
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
link: [
|
link: [
|
||||||
@@ -195,6 +194,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['filteredEvents']),
|
...mapGetters(['filteredEvents']),
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
|
plainDescription () {
|
||||||
|
return htmlToText.fromString(this.event.description.replace('\n', '').slice(0, 1000))
|
||||||
|
},
|
||||||
next () {
|
next () {
|
||||||
let found = false
|
let found = false
|
||||||
const event = this.filteredEvents.find(e => {
|
const event = this.filteredEvents.find(e => {
|
||||||
|
|||||||
Reference in New Issue
Block a user