aider/_layouts/default.html
Paul Gauthier db994fb203 aider: Updated the reference to highlight_image in default.html to use page.highlight_image.
# Aider chat conversation:

USER: in default.html, how should i reference the `highlight_image` declared in the markdown front matter?

ASSISTANT: To reference the `highlight_image` front matter variable in `default.html`, you can use the Liquid syntax `{{ page.highlight_image }}`.

Here's the change in a *SEARCH/REPLACE block*:

_layouts/default.html
<source>html
<<<<<<< SEARCH
    {% if highlight_image %}
    <meta property="og:image" content="{{ site.url }}{{ highlight_image }}">
=======
    {% if page.highlight_image %}
    <meta property="og:image" content="{{ site.url }}{{ page.highlight_image }}">
>>>>>>> REPLACE
</source>

This checks if `page.highlight_image` is defined in the front matter of the current page. If so, it sets the `og:image` meta tag to the full URL of the highlight image by prepending `site.url` to `page.highlight_image`.
2024-05-06 16:26:56 -07:00

60 lines
3 KiB
HTML

<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">
{% seo %}
{% if page.highlight_image %}
<meta property="og:image" content="{{ site.url }}{{ page.highlight_image }}">
{% else %}
<meta property="og:image" content="{{ site.url }}/assets/aider.jpg">
{% endif %}
<meta property="twitter:image" content="{{ site.url }}/assets/aider-square.jpg">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/assets/icons/favicon-32x32.png' | relative_url }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/assets/icons/favicon-16x16.png' | relative_url }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/assets/icons/apple-touch-icon.png' | relative_url }}">
<link rel="manifest" href="{{ '/assets/icons/site.webmanifest' | relative_url }}">
<link rel="mask-icon" href="{{ '/assets/icons/safari-pinned-tab.svg' | relative_url }}" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
{% include head-custom.html %}
</head>
<body>
<a id="skip-to-content" href="#content">Skip to the content.</a>
<header class="page-header" role="banner">
{% if page.url == "/" %}
<h1 class="project-name">aider</h1>
<h2 class="project-tagline">AI pair programming in your terminal</h2>
{% else %}
<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
{% endif %}
<a href="{{ site.url }}/" class="btn">Home</a>
<a href="{{ site.url }}/blog/" class="btn">Blog</a>
{% if site.github.is_project_page %}
<a href="{{ site.github.repository_url }}" class="btn">GitHub</a>
{% endif %}
{% if site.show_downloads %}
<a href="{{ site.github.zip_url }}" class="btn">Download .zip</a>
<a href="{{ site.github.tar_url }}" class="btn">Download .tar.gz</a>
{% endif %}
</header>
<main id="content" class="main-content" role="main">
{{ content }}
<footer class="site-footer">
{% if site.github.is_project_page %}
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name }}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span>
{% endif %}
</footer>
</main>
</body>
</html>