This commit is contained in:
2026-04-19 09:56:55 +09:00
parent a7cc45a030
commit 867ae25fa0
4 changed files with 11 additions and 5 deletions

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

+8 -4
View File
@@ -29,14 +29,14 @@
<meta property="og:site_name" content="nercone's website">
<meta property="og:title" content="{{ self.title() }}">
<meta property="og:description" content="{{ self.description() }}">
<meta property="og:image" content="https://nercone.dev/assets/images/thumbnail/{{ request.url.path.strip('/') or 'index' }}?title={{ self.title() | replace(' - Nercone', '') | urlencode }}&description={{ self.description() | urlencode }}&template={% block thumbnail_template %}normal{% endblock %}">
<meta property="og:image" content="https://nercone.dev/assets/images/thumbnails/{{ request.url.path.strip('/') or 'index' }}?title={% block thumbnail_title %}{{ self.title() | re_sub(' - Nercone.*$', '') | urlencode }}{% endblock %}&description={% block thumbnail_description %}{{ self.description() | urlencode }}{% endblock %}&template={% block thumbnail_template %}normal{% endblock %}">
<meta property="og:url" content="https://nercone.dev/">
<meta property="og:type" content="website">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ self.title() }}">
<meta name="twitter:description" content="{{ self.description() }}">
<meta name="twitter:image" content="https://nercone.dev/assets/images/thumbnail/{{ request.url.path.strip('/') or 'index' }}?title={{ self.title() | replace(' - Nercone', '') | urlencode }}&description={{ self.description() | urlencode }}&template={{ self.thumbnail_template() }}">
<meta name="twitter:image" content="https://nercone.dev/assets/images/thumbnails/{{ request.url.path.strip('/') or 'index' }}?title={% block thumbnail_title %}{{ self.title() | re_sub(' - Nercone.*$', '') | urlencode }}{% endblock %}&description={% block thumbnail_description %}{{ self.description() | urlencode }}{% endblock %}&template={{ self.thumbnail_template() }}">
<!-- PWA (Progressive Web App) -->
<link rel="manifest" href="/site.webmanifest">
<link rel="apple-touch-icon" href="/assets/images/favicon.png" sizes="1200x1200">
@@ -69,15 +69,19 @@
{% block custom_footer %}
<footer class="flex text-tx-alt">
<div class="flex-1 flex">
<a href="/" class="text-no-decoration hide show-on-medium show-on-large font-bold">nercone.dev</a>
<a href="/" class="text-no-decoration hide show-on-medium show-on-large font-bold">{% block footer_domain_prefix %}{% endblock %}nercone.dev{% block footer_domain_suffix %}{% endblock %}</a>
{% block footer_links %}
<a href="/about/" class="text-no-decoration bold-on-small">about</a>
<a href="/links/" class="text-no-decoration bold-on-small">links</a>
<a href="/projects/" class="text-no-decoration bold-on-small">projects</a>
<a href="/blog/" class="text-no-decoration bold-on-small">blog</a>
<a href="/projects/" class="text-no-decoration hide show-on-large">projects</a>
<a href="{{ onion_site_url }}" class="text-no-decoration hide show-on-large">onion</a>
<a href="mailto:nercone@nercone.dev" class="text-no-decoration hide show-on-large">email</a>
<a href="/public-key/" class="text-no-decoration hide show-on-large">public-key</a>
<a href="/vulnerability-reporters/" class="text-no-decoration hide show-on-large">vulnerability-reporters</a>
<a href="?lightweight=1" class="text-no-decoration hide show-on-medium show-on-large">lightweight-mode</a>
{% block extra_footer_links %}{% endblock %}
{% endblock %}
</div>
<div class="flex">
<a href="https://github.com/nercone-dev/"><img alt="github" src="/assets/images/icons/github.svg" class="small-icon"></a>
+3 -1
View File
@@ -1,4 +1,5 @@
import io
import re
import json
import yaml
import random
@@ -25,6 +26,7 @@ accesscounter = AccessCounter()
templates.env.globals["get_access_count"] = accesscounter.get
templates.env.globals["server_version"] = server_version
templates.env.globals["onion_site_url"] = f"http://{onion_hostname}/"
templates.env.filters["re_sub"] = lambda s, pattern, repl: re.sub(pattern, repl, s)
class CustomHTMLRenderer(mistune.HTMLRenderer):
def block_code(self, code, **attrs):
@@ -101,7 +103,7 @@ welcome to nercone.dev!
async def fake_error_page(request: Request, code: str):
return error_page(templates=templates, request=request, status_code=int(code))
@app.api_route("/assets/images/thumbnail/{path:path}", methods=["GET"])
@app.api_route("/assets/images/thumbnails/{path:path}", methods=["GET"])
async def thumbnail(request: Request, path: str) -> Response:
title = request.query_params.get("title", "Untitled Page")
description = request.query_params.get("description", "No description.")