{% set title = config.site_name %}
{% if page and page.meta and page.meta.title %}
  {% set title = title ~ " - " ~ page.meta.title %}
{% elif page and page.title and not page.is_homepage %}
  {% set title = title ~ " - " ~ page.title | striptags %}
{% endif %}

{% set description = config.site_description %}
{% if page and page.meta and page.meta.description %}
  {% set description = page.meta.description %}
{% elif config.site_description %}
  {% set description = config.site_description %}
{% else %}
  {% set description = "Janito - AI-powered development assistant that helps you write, analyze, and debug code with precision and transparency." %}
{% endif %}

{% set image = config.site_url ~ 'assets/images/social-preview.png' %}
{% if page and page.meta and page.meta.image %}
  {% set image = page.meta.image %}
{% endif %}

{% set url = page.canonical_url %}
{% if not url %}
  {% set url = config.site_url %}
{% endif %}

<!-- Primary Meta Tags -->
<title>{{ title }}</title>
<meta name="title" content="{{ title }}" />
<meta name="description" content="{{ description }}" />

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ url }}" />
<meta property="og:title" content="{{ title }}" />
<meta property="og:description" content="{{ description }}" />
<meta property="og:image" content="{{ image }}" />
<meta property="og:site_name" content="{{ config.site_name }}" />

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="{{ url }}" />
<meta property="twitter:title" content="{{ title }}" />
<meta property="twitter:description" content="{{ description }}" />
<meta property="twitter:image" content="{{ image }}" />
<meta name="twitter:site" content="@janito_ai" />
<meta name="twitter:creator" content="@janito_ai" />

<!-- LinkedIn -->
<meta property="og:locale" content="en_US" />
<meta name="author" content="Janito" />

<!-- Additional SEO -->
<meta name="robots" content="index, follow" />
<meta name="keywords" content="AI, development, coding, programming, assistant, tools, automation, software engineering" />