From b89d16526b834a292c736f109322e5c8f3c1b72e Mon Sep 17 00:00:00 2001
From: amaank404 <71920621+amaank404@users.noreply.github.com>
Date: Mon, 23 Jun 2025 01:50:44 +0530
Subject: [PATCH 1/4] Added dynamic page titles, the title now contains the
repo url
---
src/server/query_processor.py | 10 ++++++++++
src/server/templates/git.jinja | 7 +++++++
src/server/templates/index.jinja | 7 +++++++
src/static/js/utils.js | 3 +++
4 files changed, 27 insertions(+)
diff --git a/src/server/query_processor.py b/src/server/query_processor.py
index 1440a5e5..4597a829 100644
--- a/src/server/query_processor.py
+++ b/src/server/query_processor.py
@@ -69,9 +69,19 @@ async def process_query(
template_response = partial(templates.TemplateResponse, name=template)
max_file_size = log_slider_to_size(slider_position)
+ # Find the Short Repository URL:
+ # 1. https://github.com/abc/xyz -> abc/xyz.
+ # 2. abc/xyz -> abc/xyz (doesn't change)
+ if input_text.count("/") > 1:
+ short_repo_url = input_text.rsplit("/", 2)[1:]
+ short_repo_url = "/".join(short_repo_url)
+ else:
+ short_repo_url = input_text
+
context = {
"request": request,
"repo_url": input_text,
+ "short_repo_url": short_repo_url,
"examples": EXAMPLE_REPOS if is_index else [],
"default_file_size": slider_position,
"pattern_type": pattern_type,
diff --git a/src/server/templates/git.jinja b/src/server/templates/git.jinja
index 62def5c1..42db26ee 100644
--- a/src/server/templates/git.jinja
+++ b/src/server/templates/git.jinja
@@ -1,4 +1,11 @@
{% extends "base.jinja" %}
+{% block title %}
+ {% if short_repo_url %}
+ Gitingtest - {{ short_repo_url }}
+ {% else %}
+ Gitingtest
+ {% endif %}
+{% endblock %}
{% block content %}
{% if error_message %}
function submitExample(repoName) {
diff --git a/src/static/js/utils.js b/src/static/js/utils.js
index 835d513f..eba042eb 100644
--- a/src/static/js/utils.js
+++ b/src/static/js/utils.js
@@ -109,6 +109,9 @@ function handleSubmit(event, showLoading = false) {
starsElement.textContent = starCount;
}
+ // Set dynamic title that includes the repo name.
+ document.title = document.body.getElementsByTagName('title')[0].textContent;
+
// Scroll to results if they exist
const resultsSection = document.querySelector('[data-results]');
if (resultsSection) {
From d5bdbd78f41e036869e99b6a09f34620a157dada Mon Sep 17 00:00:00 2001
From: amaank404 <71920621+amaank404@users.noreply.github.com>
Date: Mon, 23 Jun 2025 02:26:23 +0530
Subject: [PATCH 2/4] fixed a typo. gitingtest -> gitingest
---
src/server/templates/git.jinja | 4 ++--
src/server/templates/index.jinja | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/server/templates/git.jinja b/src/server/templates/git.jinja
index 42db26ee..2465069b 100644
--- a/src/server/templates/git.jinja
+++ b/src/server/templates/git.jinja
@@ -1,9 +1,9 @@
{% extends "base.jinja" %}
{% block title %}
{% if short_repo_url %}
- Gitingtest - {{ short_repo_url }}
+ Gitingest - {{ short_repo_url }}
{% else %}
- Gitingtest
+ Gitingest
{% endif %}
{% endblock %}
{% block content %}
diff --git a/src/server/templates/index.jinja b/src/server/templates/index.jinja
index bdb7105c..2d2524d9 100644
--- a/src/server/templates/index.jinja
+++ b/src/server/templates/index.jinja
@@ -1,9 +1,9 @@
{% extends "base.jinja" %}
{% block title %}
{% if short_repo_url %}
- Gitingtest - {{ short_repo_url }}
+ Gitingest - {{ short_repo_url }}
{% else %}
- Gitingtest
+ Gitingest
{% endif %}
{% endblock %}
{% block extra_head %}
From c1aab76c613a9305890e14dd676b5ea0a94e05d1 Mon Sep 17 00:00:00 2001
From: amaank404 <71920621+amaank404@users.noreply.github.com>
Date: Mon, 23 Jun 2025 16:39:20 +0530
Subject: [PATCH 3/4] Changed the user/repo extraction method
---
src/server/query_processor.py | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/server/query_processor.py b/src/server/query_processor.py
index 4597a829..35a0fc53 100644
--- a/src/server/query_processor.py
+++ b/src/server/query_processor.py
@@ -69,19 +69,9 @@ async def process_query(
template_response = partial(templates.TemplateResponse, name=template)
max_file_size = log_slider_to_size(slider_position)
- # Find the Short Repository URL:
- # 1. https://github.com/abc/xyz -> abc/xyz.
- # 2. abc/xyz -> abc/xyz (doesn't change)
- if input_text.count("/") > 1:
- short_repo_url = input_text.rsplit("/", 2)[1:]
- short_repo_url = "/".join(short_repo_url)
- else:
- short_repo_url = input_text
-
context = {
"request": request,
"repo_url": input_text,
- "short_repo_url": short_repo_url,
"examples": EXAMPLE_REPOS if is_index else [],
"default_file_size": slider_position,
"pattern_type": pattern_type,
@@ -101,6 +91,9 @@ async def process_query(
if not query.url:
raise ValueError("The 'url' parameter is required.")
+ # Sets the "
/" for the page title
+ context["short_repo_url"] = f"{query.user_name}/{query.repo_name}"
+
clone_config = query.extract_clone_config()
await clone_repo(clone_config, token=token)
summary, tree, content = ingest_query(query)
From 30cebb7de7100731d52b3156edc38a03c6fd5119 Mon Sep 17 00:00:00 2001
From: amaank404 <71920621+amaank404@users.noreply.github.com>
Date: Tue, 24 Jun 2025 02:46:08 +0530
Subject: [PATCH 4/4] relocated title logic to base.jinja template
---
src/server/templates/base.jinja | 8 +++++++-
src/server/templates/git.jinja | 7 -------
src/server/templates/index.jinja | 7 -------
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/server/templates/base.jinja b/src/server/templates/base.jinja
index c7de0779..cc33dce9 100644
--- a/src/server/templates/base.jinja
+++ b/src/server/templates/base.jinja
@@ -33,7 +33,13 @@
- {% block title %}Gitingest{% endblock %}
+ {% block title %}
+ {% if short_repo_url %}
+ Gitingest - {{ short_repo_url }}
+ {% else %}
+ Gitingest
+ {% endif %}
+ {% endblock %}
diff --git a/src/server/templates/git.jinja b/src/server/templates/git.jinja
index 2465069b..62def5c1 100644
--- a/src/server/templates/git.jinja
+++ b/src/server/templates/git.jinja
@@ -1,11 +1,4 @@
{% extends "base.jinja" %}
-{% block title %}
- {% if short_repo_url %}
- Gitingest - {{ short_repo_url }}
- {% else %}
- Gitingest
- {% endif %}
-{% endblock %}
{% block content %}
{% if error_message %}
function submitExample(repoName) {