Skip to content

Enhance Repo to support multiple static sites and implement client-side redirect mechanism #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ <h2>Get in touch</h2>
<li><input type="submit" value="Send" class="special"/></li>
<li><input type="reset" value="Reset"/></li>
</ul>
</form>
</section>
</div>
<footer id="footer" class="panel">
<div class="inner split">
...
</div>
</footer>
</div>
<script src="site1/redirect.js"></script>
13 changes: 13 additions & 0 deletions redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Get the current URL path
var path = window.location.pathname;

// Redirect the user based on the URL path
if (path === "/site1") {
window.location.href = "site1/index.html";
} else if (path === "/site2") {
window.location.href = "site2/index.html";
} else {
// If the path does not match any of the above, redirect the user to the main site
window.location.href = "index.html";
}

15 changes: 15 additions & 0 deletions site1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site 1</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Welcome to Site 1</h1>
<p>This is the first static site hosted in this repository.</p>
<script src="site1/script.js"></script>
</body>
</html>

8 changes: 8 additions & 0 deletions site1/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Import any necessary modules or libraries

// Define any variables or constants

// Implement any functions or event handlers

// Add any additional code specific to the "site1" static site

15 changes: 15 additions & 0 deletions site2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site 2</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Welcome to Site 2</h1>
<p>This is the second static site hosted in this repository.</p>
<script src="site2/script.js"></script>
</body>
</html>

8 changes: 8 additions & 0 deletions site2/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Import any necessary modules or libraries

// Define any variables or constants

// Implement any functions or event handlers

// Add any ad