elixir/templates/ident.html
Franciszek Stachura 7d629429bf Generate different meta tag descriptions for different views
Added an ability to customize contents of meta description tag in
templates that inherit from layout. This replaces the default
description previously used in all views.
This change could help with SEO and missing descriptions in search
results (#167). It's based on advice from
https://developers.google.com/search/docs/appearance/snippet

> Create unique descriptions for each page on your site
> Programmatically generate descriptions

This is not guaranteed to fix the issue, search engines are opaque.

All custom descriptions start with "Elixir Cross Referencer - ".

Currently customized descriptions:
* source - path to the file, project name and version
* ident - name of the searched identifier, project name and version

Everything else uses the previous, default description.
2024-08-20 10:35:17 +02:00

53 lines
2 KiB
HTML

{% extends "layout.html" %}
{% block title %}
{{ searched_ident|e }} identifier - {{ current_project|capitalize }} source code {{ current_tag }} - Bootlin
{% endblock %}
{% block description -%}
Elixir Cross Referencer - identifier references search for {{ current_project|capitalize }} (version {{ current_tag }}). Searched identifier: {{ searched_ident|e }}
{%- endblock %}
{% block main %}
<div class="lxrident">
{% if symbol_sections|length != 0 %}
{% for section in symbol_sections %}
{% if 'symbols' in section %}
{% for type, symbols in section['symbols'].items() %}
<h2>{{ section['title'] }} in {{ symbols|length }} files
{{- ' as a '+type if type != '_unknown' else '' -}}:</h2>
<ul>
{% for symbol in symbols %}
<li>
<a href="{{ symbol.lines[0].url }}">
<strong>{{ symbol.path }}</strong>
{%- if symbol.lines|length == 1 %},
line {{ symbol.lines[0].lineno }}
{%- elif symbols|length > 100 %},
<em>{{ symbol.lines|length }} times</em>
{% endif %}
{% if symbol.type is not none %}
<em>(as a {{ symbol.type }})</em>
{% endif %}
</a>
{% if symbol.lines|length > 1 and symbols|length <= 100 %}
<ul>
{% for line, url in symbol.lines %}
<li><a href="{{ url }}">line {{ line }}</a>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
{% else %}
<h2>{{ section['message'] }}</h2>
{% endif %}
{% endfor %}
{% else %}
<h2>Identifier not used</h2>
{% endif %}
</div>
{% endblock %}