bmk's avatar
Level 1

Statamic + SEO

Hey, I am working on a Statamic project for the first time, a basic portfolio type website. I must say that it was a blast learning and working with it. The course learn Statamic with Jack was very helpful of course.

However I've been wondering how to configure SEO, without using an add-on? I tried googling some solutions, however not much out there, or my googling needs improvement.

Any suggestion/idea will be of great help. Thanks.

0 likes
3 replies
jlrdw's avatar

if you have a regular landing page, ie., you are using with laravel, then make you initial page seo. All pages on a site doesn't have to be seo. Just suggestion.

bmk's avatar
Level 1

@jlrdw thanks for your suggestion. I am definitively not a SEO whizz, so not sure if I am doing this correctly.

This is working, and it's providing the categories sitemap and how I've handled this so far, of course I need to add static pages and other collections (I used Jack McDade basic meta options), I am still working on the sitemap, using the following as some guide (https://github.com/spatie/laravel-sitemap) and (https://laravel-news.com/laravel-automatic-sitemap) including the sitemap options...

Any suggestions, or thoughts of maybe improving this setup are greatly appreciated.

title: SEO
fields:
  -
    handle: meta_title
    field:
      type: text
      display: Title
      localizable: false
  -
    handle: meta_description
    field:
      type: textarea
      display: Description
      localizable: false
  -
    handle: meta_keywords
    field:
      type: taggable
      display: Keywords
      localizable: false
  -

The head setup in layout.antlers

 <title>{{ meta_title ?? title }}</title>
        {{ if meta_description }}
        <meta name="description" content="{{ meta_description }}" />
        {{ /if }} {{ if meta_keywords }}
        <meta name="keywords" content="{{ meta_keywords | join(', ') }}" />
        {{ /if }} 

The Sitemap logic that I added in the Controllers folder with the Sitemap fieldset options.

Messiahnjnava's avatar

Your manual setup looks solid. Consider using Statamic's built-in SEO fields or a global variable for default meta. Smart sitemap approach.

Please or to participate in this conversation.