Browse Source

feat: term in title

Blair Noctis 8 months ago
parent
commit
84e223677d
2 changed files with 2 additions and 2 deletions
  1. 1 1
      main.py
  2. 1 1
      templates/index.html

+ 1 - 1
main.py

@@ -52,7 +52,7 @@ def catch_all(path):
     scraped = scrape(f"https://urbandictionary.com/{re.sub(r'.*://.*/', '/', request.url)}")
     if type(scraped) == str and scraped.startswith("REDIRECT"):
         return redirect(scraped.replace("REDIRECT ", ""), 302)
-    return render_template('index.html', data=scraped)
+    return render_template('index.html', data=scraped, term=request.args.get("term"))
 
 if __name__ == '__main__':
     from waitress import serve

+ 1 - 1
templates/index.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
-    <title>Rural Dictionary</title>
+    <title>Rural Dictionary{% if term %}: {{ term }}{% endif %}</title>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width">
     <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">