Searxng Frequent Sites

This revision is from 2024/08/11 18:12. You can Restore it.

templates/simple/index.html

{% extends "simple/base.html" %}

{% from 'simple/icons.html' import icon_big %}

{% block content %}

<div class="index">

<div class="title"><h1>SearXNG</h1></div>

{% include 'simple/simple_search.html' %}

{% if most_visited_sites %}

<div class="top-sites">

<div class="site-grid" style="margin-top: 33px; max-width: 60%; margin-left: auto; margin-right: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px;">

{% for site in most_visited_sites %}

<a href="{{ site.url }}" class="site-tile">

<img src="{{ site.favicon }}" alt="{{ site.title }} favicon" width="32">

</a>

{% endfor %}

</div>

</div>

{% endif %}

</div>

{% endblock %}

/searx/preferences.py:482

self.key_value_settings['custom_text'] = StringSetting(

'', locked=is_locked('custom_text')

)

/templates/simple/preferences.html

{{- tab_header('maintab', 'quicklinks', _('Quick Links')) -}}

{%- include 'simple/preferences/quicklinks.html' -%}

{{- tab_footer() -}}

/searx/webapp.py

def get_most_visited_sites(request, limit=50):

sites = []

custom_text = request.preferences.get_value('custom_text')

print(f"Cookie value: {custom_text}") # Debugging: check the cookie value

if custom_text:

# Split the cookie value by newlines instead of commas

for entry in custom_text.splitlines():

parts = entry.strip().split('|')

if len(parts) == 3:

sites.append({

"url": parts[0],

"title": parts[1],

"favicon": parts[2]

})

print(f"Parsed sites: {sites}") # Debugging: check the parsed list

return sites[:limit]

  

📝 📜 ⏱️ ⬆️