Skip to content

Commit 2e465ec

Browse files
committed
sitewide bs
1 parent eaf846b commit 2e465ec

File tree

9 files changed

+327
-137
lines changed

9 files changed

+327
-137
lines changed

404.html

Lines changed: 106 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,112 @@
11
---
2-
layout: base
2+
layout: null
33
permalink: /404.html
4-
title: Page Not Found - GitHubTree
5-
description: The page you were looking for couldn't be found. It might have been removed, renamed, or didn't exist in the first place.
64
---
7-
8-
<div class="error-container">
9-
<h2>404: Repository Not Found</h2>
10-
<p>The GitHub repository you're looking for couldn't be located. It might be private, removed, or doesn't exist.</p>
11-
12-
<div class="error-actions">
13-
<a href="/" class="home-link">
14-
<i class="fas fa-home"></i> Return to homepage
15-
</a>
16-
</div>
17-
18-
<div class="error-suggestions">
19-
<h3>Popular repositories to explore:</h3>
20-
<ul class="suggestions-list">
21-
{% for repository in site.data.repositories limit:5 %}
22-
<li><a href="/repo/{{ repository.repo }}/{{ repository.branch }}/">{{ repository.repo }}</a></li>
23-
{% endfor %}
24-
</ul>
25-
</div>
26-
</div>
27-
28-
<style>
29-
.error-container {
30-
text-align: center;
31-
padding: 40px 20px;
32-
max-width: 800px;
33-
margin: 0 auto;
34-
}
35-
36-
.error-container h2 {
37-
font-size: 32px;
38-
color: #e74c3c;
39-
margin-bottom: 20px;
40-
}
41-
42-
.error-actions {
43-
margin: 30px 0;
44-
}
45-
46-
.home-link {
47-
display: inline-block;
48-
padding: 10px 20px;
49-
background-color: #024ea2;
50-
color: white;
51-
text-decoration: none;
52-
border-radius: 4px;
53-
transition: background-color 0.3s;
54-
}
55-
56-
.home-link:hover {
57-
background-color: #023e82;
58-
}
59-
60-
.error-suggestions {
61-
margin-top: 40px;
62-
padding: 20px;
63-
background-color: #f5f5f5;
64-
border-radius: 8px;
65-
}
66-
67-
.error-suggestions h3 {
68-
margin-bottom: 15px;
69-
}
70-
71-
.suggestions-list {
72-
list-style: none;
73-
padding: 0;
74-
display: flex;
75-
flex-wrap: wrap;
76-
justify-content: center;
77-
}
78-
79-
.suggestions-list li {
80-
margin: 8px 12px;
81-
}
82-
83-
.suggestions-list a {
84-
color: #024ea2;
85-
text-decoration: none;
86-
}
87-
88-
.suggestions-list a:hover {
89-
text-decoration: underline;
90-
}
91-
92-
@media (max-width: 768px) {
93-
.error-container h2 {
94-
font-size: 24px;
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
<head>
8+
<meta charset="UTF-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
10+
<title>GitHubTree 404: Page Not Found</title>
11+
<style>
12+
body {
13+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
14+
margin: 0;
15+
padding: 20px;
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
min-height: 100vh;
20+
background-color: #f6f8fa;
21+
}
22+
.error-container {
23+
text-align: center;
24+
padding: 40px 20px;
25+
max-width: 800px;
26+
margin: 0 auto;
27+
}
28+
h2 {
29+
font-size: 32px;
30+
color: #e74c3c;
31+
margin-bottom: 20px;
32+
}
33+
p {
34+
font-size: 16px;
35+
line-height: 1.5;
36+
color: #333;
37+
margin-bottom: 30px;
38+
}
39+
.home-link {
40+
display: inline-block;
41+
padding: 10px 20px;
42+
background-color: #024ea2;
43+
color: white;
44+
text-decoration: none;
45+
border-radius: 4px;
46+
transition: background-color 0.3s;
47+
}
48+
.home-link:hover {
49+
background-color: #023e82;
50+
}
51+
.error-suggestions {
52+
margin-top: 40px;
53+
padding: 20px;
54+
background-color: #f5f5f5;
55+
border-radius: 8px;
56+
}
57+
.error-suggestions h3 {
58+
margin-bottom: 15px;
9559
}
96-
9760
.suggestions-list {
98-
flex-direction: column;
61+
list-style: none;
62+
padding: 0;
63+
display: flex;
64+
flex-wrap: wrap;
65+
justify-content: center;
66+
}
67+
.suggestions-list li {
68+
margin: 8px 12px;
69+
}
70+
.suggestions-list a {
71+
color: #024ea2;
72+
text-decoration: none;
73+
}
74+
.suggestions-list a:hover {
75+
text-decoration: underline;
9976
}
100-
}
101-
</style>
77+
</style>
78+
<script>
79+
// If the path starts with /repo/, load index.html content and update the URL
80+
if (location.pathname.startsWith('/repo/')) {
81+
history.replaceState({}, '', location.pathname + location.search + location.hash);
82+
fetch('/index.html')
83+
.then(r => r.text())
84+
.then(html => {
85+
document.open();
86+
document.write(html);
87+
document.close();
88+
});
89+
}
90+
</script>
91+
</head>
92+
<body>
93+
<div class="error-container">
94+
<h2>404: Page Not Found</h2>
95+
<p>The page you're looking for couldn't be located. It might have been removed, renamed, or didn't exist in the first place.</p>
96+
97+
<div class="error-actions">
98+
<a href="/" class="home-link">Return to homepage</a>
99+
</div>
100+
101+
<div class="error-suggestions">
102+
<h3>Featured repositories to explore:</h3>
103+
<ul class="suggestions-list">
104+
{% assign shuffled_repos = site.data.repositories | sample: 5 %}
105+
{% for repository in shuffled_repos %}
106+
<li><a href="/repo/{{ repository.repo }}/{{ repository.branch | default: 'main' }}/">{{ repository.repo }}</a></li>
107+
{% endfor %}
108+
</ul>
109+
</div>
110+
</div>
111+
</body>
112+
</html>

_config.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ defaults:
3434
path: ""
3535
values:
3636
image: /assets/images/preview.png
37-
- scope:
38-
path: "/repo/*"
39-
values:
40-
sitemap: true
41-
layout: repository
42-
- scope:
43-
path: "/repo/**/*"
44-
values:
45-
sitemap: true
46-
layout: repository
4737
- scope:
4838
path: "assets/css"
4939
values:

_includes/footer.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
<div class="disc">
2-
<i>Works best with public repositories. For private ones, <a href="https://github.com/mgks/GitHubTree#accessing-private-repositories-advanced" target="_blank" rel="noopener noreferrer">fork the project</a> and add a Personal Access Token.</i>
3-
</div>
41
<div class="footer">
52
<a href="https://github.com/mgks"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="1.0166668891906738 2.9749999046325684 21.966665267944336 20.024999618530273"><path d="M7 3c-1.535 0-3.078.5-4.25 1.7-2.343 2.4-2.279 6.1 0 8.5L12 23l9.25-9.8c2.279-2.4 2.343-6.1 0-8.5-2.343-2.3-6.157-2.3-8.5 0l-.75.8-.75-.8C10.078 3.5 8.536 3 7 3" fill="#e74c3c"></path></svg> Developed by @mgks</a> | <a href="/featured-repos">Featured Repositories</a> | <a href="https://github.com/mgks/GitHubTree">GitHub Repo</a>
63
</div>

_layouts/base.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
---
22
layout: minimal
3-
show_support: true
4-
show_search: true
5-
show_share_overlay: true
63
---
74
<div class="tree-container" id="tree-container" style="display: none;">
85
<div class="tree-header">

_layouts/minimal.html

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,27 @@
8888
});
8989
}
9090
</script>
91+
92+
<script>
93+
// Handle repository path parameter from 404 redirects
94+
document.addEventListener('DOMContentLoaded', function() {
95+
// Code for repository path parameter
96+
});
97+
</script>
9198
</head>
9299
<body>
93-
<div class="container">
100+
<div class="wrapper">
94101
{% include header.html %}
95102

96-
{% if layout.show_support != false %}
103+
{% if page.show_support != false %}
97104
<div class="support-block">
98105
<a href="https://github.com/sponsors/mgks" class="support-button">
99106
<span class="fas fa-heart"></span> Support the Project
100107
</a>
101108
</div>
102109
{% endif %}
103110

104-
{% if layout.show_search != false %}
111+
{% if page.show_search != false %}
105112
<div class="search-area">
106113
<div class="input-area">
107114
<input type="text" id="repoInput" placeholder="username/repo" value="{% if page.repo_name %}{{ page.repo_name }}{% else %}mgks/GitHubTree{% endif %}">
@@ -118,10 +125,16 @@
118125
{{ content }}
119126
</div>
120127

128+
{% if page.show_search != false %}
129+
<div class="disc">
130+
<i>Works best with public repositories. For private ones, <a href="https://github.com/mgks/GitHubTree#accessing-private-repositories-advanced" target="_blank" rel="noopener noreferrer">fork the project</a> and add a Personal Access Token.</i>
131+
</div>
132+
{% endif %}
133+
121134
{% include footer.html %}
122135
</div>
123136

124-
{% if layout.show_share_overlay != false %}
137+
{% if page.show_share_overlay != false %}
125138
<div id="shareOverlay" class="share-container-overlay">
126139
<div class="share-content-box">
127140
<input type="text" id="shareUrlInput" readonly title="Shareable URL">
@@ -134,11 +147,6 @@
134147
{% if page.repo_name %}
135148
<script>
136149
document.addEventListener('DOMContentLoaded', function() {
137-
// Don't do anything if we're on a 404 page
138-
if (document.querySelector('.error-container')) {
139-
return;
140-
}
141-
142150
// Redirect legacy parameter URLs to clean URLs
143151
const urlParams = new URLSearchParams(window.location.search);
144152
const repoParam = urlParams.get('repo');
@@ -154,7 +162,10 @@
154162
// Trigger fetch automatically for repo pages
155163
// The static-repo.js script will prevent actual fetching for static pages
156164
setTimeout(function() {
157-
document.getElementById('fetchButton').click();
165+
const fetchButton = document.getElementById('fetchButton');
166+
if (fetchButton) {
167+
fetchButton.click();
168+
}
158169
}, 100);
159170
}
160171
});

_layouts/repository.html

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
---
22
layout: base
3-
---
3+
---
4+
<script>
5+
document.addEventListener('DOMContentLoaded', function() {
6+
// Extract repository information from URL path
7+
const path = window.location.pathname;
8+
const pathMatch = path.match(/\/repo\/([^\/]+)\/([^\/]+)\/([^\/]+)\/?$/);
9+
10+
if (pathMatch) {
11+
const [, user, repo, branch] = pathMatch;
12+
const fullRepo = `${user}/${repo}`;
13+
14+
// Set input values
15+
const repoInput = document.getElementById('repoInput');
16+
const branchInput = document.getElementById('branchInput');
17+
18+
if (repoInput && branchInput) {
19+
repoInput.value = fullRepo;
20+
branchInput.value = branch;
21+
22+
// Trigger fetch automatically
23+
setTimeout(function() {
24+
const fetchButton = document.getElementById('fetchButton');
25+
if (fetchButton) {
26+
fetchButton.click();
27+
}
28+
}, 100);
29+
}
30+
}
31+
// If URL doesn't match the exact pattern, we don't try to process it
32+
// This could be a partial path like /repo/user/ which we just show as is
33+
});
34+
</script>
35+
{{ content }}

0 commit comments

Comments
 (0)