perf: SEO improvements — defer d3.js, shorter title, Permissions-Policy

- Add defer to d3.v7.min.js in base.html — eliminates ~1.8s render
  blocking on every page (d3 only needed on user interaction)
- Shorten landing page title from 71 to 59 chars (SEO optimum: 30-60)
- Add Permissions-Policy security header (camera, microphone, geolocation)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-07 17:28:02 +02:00
parent e75f33126b
commit d8d3c2edf4
3 changed files with 3 additions and 2 deletions

1
app.py
View File

@ -791,6 +791,7 @@ def set_security_headers(response):
response.headers['X-XSS-Protection'] = '1; mode=block'
response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains'
response.headers['Referrer-Policy'] = 'strict-origin-when-cross-origin'
response.headers['Permissions-Policy'] = 'camera=(), microphone=(), geolocation=(self)'
# Freshness signal for SEO crawlers
if response.content_type and 'text/html' in response.content_type and 'Last-Modified' not in response.headers:

View File

@ -2596,7 +2596,7 @@
</script>
<!-- D3.js for Connections Map Modal -->
<script src="{{ url_for('static', filename='js/vendor/d3.v7.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/d3.v7.min.js') }}" defer></script>
<!-- Scroll Animations (Sprint 4) -->
<script src="{{ url_for('static', filename='js/scroll-animations.js') }}" defer></script>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Norda Biznes Partner - Firmy Członkowskie Izby Gospodarczej | Wejherowo{% endblock %}
{% block title %}Norda Biznes — Katalog Firm Członkowskich Izby Gospodarczej{% endblock %}
{% block meta_description %}Katalog {{ total_companies }} firm członkowskich Izby Gospodarczej Norda Biznes - Wejherowo, powiat wejherowski i województwo pomorskie. Networking i współpraca biznesowa.{% endblock %}