Better SEO form previews (#61)
This commit is contained in:
parent
9783b07778
commit
5486768125
|
@ -160,9 +160,16 @@ class SeoMetaResolver
|
||||||
{
|
{
|
||||||
$form = Form::whereSlug($this->patternData['slug'])->firstOrFail();
|
$form = Form::whereSlug($this->patternData['slug'])->firstOrFail();
|
||||||
|
|
||||||
return [
|
$meta = [
|
||||||
'title' => $form->title . $this->titleSuffix(),
|
'title' => $form->title . $this->titleSuffix(),
|
||||||
];
|
];
|
||||||
|
if($form->description){
|
||||||
|
$meta['description'] = Str::of($form->description)->limit(160);
|
||||||
|
}
|
||||||
|
if($form->cover_picture){
|
||||||
|
$meta['image'] = $form->cover_picture;
|
||||||
|
}
|
||||||
|
return $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTemplateShowMeta(): array
|
private function getTemplateShowMeta(): array
|
||||||
|
|
|
@ -46,6 +46,7 @@ import { mapState } from 'vuex'
|
||||||
import OpenCompleteForm from '../../components/open/forms/OpenCompleteForm'
|
import OpenCompleteForm from '../../components/open/forms/OpenCompleteForm'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import sha256 from 'js-sha256'
|
import sha256 from 'js-sha256'
|
||||||
|
import SeoMeta from '../../mixins/seo-meta'
|
||||||
|
|
||||||
const isFrame = window.location !== window.parent.location || window.frameElement
|
const isFrame = window.location !== window.parent.location || window.frameElement
|
||||||
|
|
||||||
|
@ -106,6 +107,7 @@ function loadForm (slug) {
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { OpenCompleteForm },
|
components: { OpenCompleteForm },
|
||||||
|
mixins: [SeoMeta],
|
||||||
|
|
||||||
beforeRouteEnter (to, from, next) {
|
beforeRouteEnter (to, from, next) {
|
||||||
if (window.$crisp) {
|
if (window.$crisp) {
|
||||||
|
@ -172,6 +174,12 @@ export default {
|
||||||
metaTitle () {
|
metaTitle () {
|
||||||
return this.form ? this.form.title : 'Create beautiful forms'
|
return this.form ? this.form.title : 'Create beautiful forms'
|
||||||
},
|
},
|
||||||
|
metaDescription () {
|
||||||
|
return (this.form && this.form.description) ? this.form.description.substring(0,160) : null
|
||||||
|
},
|
||||||
|
metaImage () {
|
||||||
|
return (this.form && this.form.cover_picture) ? this.form.cover_picture : null
|
||||||
|
},
|
||||||
metaTags () {
|
metaTags () {
|
||||||
return (this.form && this.form.can_be_indexed) ? [] : [{ name: 'robots', content: 'noindex' }]
|
return (this.form && this.form.can_be_indexed) ? [] : [{ name: 'robots', content: 'noindex' }]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue