Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[discussion] Setting page meta SEO tags directly #112

Open
TimFoerster opened this issue Aug 15, 2019 · 2 comments
Open

[discussion] Setting page meta SEO tags directly #112

TimFoerster opened this issue Aug 15, 2019 · 2 comments

Comments

@TimFoerster
Copy link
Contributor

Hey,

wouldn't it be better to set the seo tags directly here?

$this->page->title = $post->title;
$this->page->meta_title = $post->title;
$this->page->meta_description = $meta_description;

to

         $activeSeo = Settings::get(...);
         $this->page->title = $activeSeo && $post->post.seo_title ? $post->post.seo_title : $post->title; 
         if($activeSeo && $post->meta_description) 
             $this->page->meta_description = $meta_description;

so you can en-/disable SEO directly over the news settings and this

<title>{% if post.seo_title %}{{ post.seo_title }}{% elseif this.page.meta_title %}{{ this.page.meta_title }}{% else %}{{ this.page.title }}{% endif %}</title>

gets to this:

    <title>{{ this.page.meta_title is defined  ? this.page.meta_title : 'Default title' }}</title>
    <meta name="description" content="{{ this.page.meta_description }}">

and its compatible to other SEO plugins.

@TimFoerster
Copy link
Contributor Author

In addition we can drop the page->meta_title field like mentioned in #100

@nfebe
Copy link
Contributor

nfebe commented Oct 24, 2019

I am making a PR that mimics something like this!

 <meta name="description" content="{{ post.introductory|length > 60 ? post.introductory|slice(0, 60)|striptags ~ '…' : post.introductory|striptags }}">
<link rel="canonical" href="{{ post.url }}">
<link rel="image_src" href="{{ post.image|media }}" type="image/png" />
<meta name="keywords" content="{{ post.category.name}}, {% for tag in post.tags %}{{ tag }}{% if not loop.last %},{% endif %} {% endfor %}">


<!-- Facebook Meta Tags -->
<meta property="og:title" content="{{ post.title }} | Site Name" />
<meta property="og:type" content="article" />
<meta property="og:description" content="{{ post.introductory|length > 100 ? post.introductory|slice(0, 100)|striptags~ '…' : post.introductory|striptags}}" /> 
<meta property="og:image" content="{{ post.image|media }}" />

<!-- Twitter Card data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="Site Name">
<meta name="twitter:title" content="{{ post.title }} | Site Name">
<meta name="twitter:description" content="{{ post.introductory|length > 60 ? post.introductory|slice(0, 60)|striptags~ '…' : post.introductory|striptags}}">
<meta name="twitter:creator" content="{{ post.user.getFullNameAttribute() }}">
<meta name="twitter:image" content="{{ post.image|media }}">

We should do a comprehensive SEO by default on the indikator.news, advanced users may decide to not use the seo tag and just implement seo customarily just like the above which I would transform to component based code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants