Make honeypot/babbler URL customisable

This commit is contained in:
Badri Sunderarajan 2025-03-23 11:42:07 +05:30
parent ff9e821ae9
commit 96616e987b
Signed by: badri
GPG key ID: 9F594532AD60DE03
3 changed files with 11 additions and 4 deletions

View file

@ -96,6 +96,11 @@
"type": "text",
"default": ""
},
"babbler_url": {
"type": "text",
"default": "/article",
"description": "Prefix (without the trailing slash) where your Markov babbler or other bot honeypot is set up, so we can redirect bad bots there. Make sure to update this in robots.txt though, so as not to trap the good bots! (Currently, /article and /api are automatically added, but it's recommended to set your own if you're okay customising the theme or otherwise overriding robots.txt manually)"
},
"enter_tag_slugs": {
"type": "text",
"group": "homepage"

View file

@ -5,7 +5,7 @@ which templates loop over to generate a list of posts. --}}
<div class="post-card-content">
<a class="post-card-content-link" href="/article/{{slug}}">
<a class="post-card-content-link" href="{{ @custom.babbler_url }}/{{slug}}">
<header class="post-card-header">
{{#if primary_tag}}
{{#primary_tag}}
@ -23,7 +23,7 @@ which templates loop over to generate a list of posts. --}}
<ul class="author-list">
{{#foreach authors}}
<li class="author-list-item">
<a href="/article/author/{{slug}}" class="static-avatar author-profile-image">{{> "icons/avatar"}}</a>
<a href="{{ @custom.babbler_url }}/author/{{slug}}" class="static-avatar author-profile-image">{{> "icons/avatar"}}</a>
</li>
{{/foreach}}
</ul>
@ -34,7 +34,7 @@ which templates loop over to generate a list of posts. --}}
{{else}}
{{#foreach authors}}
<span>
<a href="/article/author/{{slug}}">
<a href="{{ @custom.babbler_url }}/author/{{slug}}">
{{name}}
</a>
</span>

View file

@ -125,13 +125,15 @@ into the {body} tag of the default.hbs template --}}
{{/get}}
{{!-- Also some false ones to honeypot evil crawlers --}}
{{#get "posts" filter="primary_tag:[{{post.tags}}]+id:-{{post.id}}" include="authors" limit="3" as |more_posts|}}
{{#if @custom.babbler_url }}
{{#get "posts" filter="primary_tag:[{{post.tags}}]+id:-{{post.id}}" include="authors" limit="5" as |more_posts|}}
{{#if more_posts}}
{{#foreach more_posts}}
{{> "honeypot-card"}}
{{/foreach}}
{{/if}}
{{/get}}
{{/if}}
</div>
</aside>