Skip to content

Commit

Permalink
Update debug message includes
Browse files Browse the repository at this point in the history
  • Loading branch information
luost26 committed Oct 22, 2024
1 parent a13f8b8 commit e052de6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
<div id="url-debug-message" class="row mt-3 d-none">
<div class="col">
<div class="alert alert-warning my-0" role="alert">
<h5><i class="fas fa-exclamation-triangle"></i> Action required</h5>
<strong>Problem:</strong>
The current root path of this site is "<code class="root-path-text"></code>",
which does not match the <code>baseurl</code> ("<code>{{ site.baseurl }}</code>") configured in <code>_config.yml</code>.
<br>

<strong>Solution:</strong>
Please set the <code>baseurl</code> in <code>_config.yml</code> to "<code class="root-path-text"></code>".
</div>
</div>
</div>

<div id="ghpages-domain-debug-message" class="row mt-3 d-none">
<div class="col">
<div class="alert alert-warning my-0" role="alert">
Expand All @@ -21,19 +6,13 @@ <h5><i class="fas fa-exclamation-triangle"></i> Warning</h5>
The current name of your GitHub Pages repository ("<code class="repo-name-text"></code>") does not match the recommended repository name for your site ("<code class="domain-name-text"></code>").
<br>
<strong>Solution:</strong> Please consider renaming the repository to "<code class="domain-name-text"></code>", so that your site can be accessed directly at "<code>http://<span class="domain-name-text"></span></code>".
However, if the current repository name is intended, you can ignore this message by removing {% raw %}"<code>{% include widgets/url_debug_message.html %}</code>"{% endraw %} in <code>index.html</code>.
However, if the current repository name is intended, you can ignore this message by removing {% raw %}"<code>{% include widgets/debug_repo_name.html %}</code>"{% endraw %} in <code>index.html</code>.
</div>
</div>
</div>

<script>
striped_pathname = location.pathname.replace(/\/+$/, "");
if(striped_pathname != "{{ site.baseurl }}"){
document.getElementById("url-debug-message").classList.remove('d-none');
}
document.querySelectorAll(".root-path-text").forEach(function(element){
element.textContent = striped_pathname;
});
document.querySelectorAll(".repo-name-text").forEach(function(element){
element.textContent = striped_pathname.replace("/", "");
});
Expand All @@ -44,5 +23,4 @@ <h5><i class="fas fa-exclamation-triangle"></i> Warning</h5>
if (striped_pathname.search("github.io") != -1 && striped_pathname != ""){
document.getElementById("ghpages-domain-debug-message").classList.remove('d-none');
}

</script>
24 changes: 24 additions & 0 deletions _includes/widgets/debug_url.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div id="url-debug-message" class="row mt-3 d-none">
<div class="col">
<div class="alert alert-warning my-0" role="alert">
<h5><i class="fas fa-exclamation-triangle"></i> Action required</h5>
<strong>Problem:</strong>
The current root path of this site is "<code class="root-path-text"></code>",
which does not match the <code>baseurl</code> ("<code>{{ site.baseurl }}</code>") configured in <code>_config.yml</code>.
<br>

<strong>Solution:</strong>
Please set the <code>baseurl</code> in <code>_config.yml</code> to "<code class="root-path-text"></code>".
</div>
</div>
</div>

<script>
striped_pathname = location.pathname.replace(/\/+$/, "");
if(striped_pathname != "{{ site.baseurl }}"){
document.getElementById("url-debug-message").classList.remove('d-none');
}
document.querySelectorAll(".root-path-text").forEach(function(element){
element.textContent = striped_pathname;
});
</script>
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
---
{% include widgets/profile_card.html %}

{% include widgets/url_debug_message.html %}
{% include widgets/debug_url.html %}
{% include widgets/debug_repo_name.html %}

{% if site.data.display.homepage.show_experience %}
{% include widgets/experience_card.html %}
Expand Down

0 comments on commit e052de6

Please sign in to comment.