Skip to content

Commit

Permalink
Support for old links
Browse files Browse the repository at this point in the history
  • Loading branch information
ethomson committed Dec 11, 2024
1 parent 84ab5c2 commit c4bfba6
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
9 changes: 9 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: 404 Not Found (libgit2)
layout: default
---
<h1>Not Found</h1>

<p>
The page that you requested was not found.
</p>
1 change: 0 additions & 1 deletion js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if (currentUrl.pathname.startsWith(referencePath + '/')) {
}

const indexUrl = `${currentUrl.origin}${indexPath}/${version}.json`;
console.log(indexUrl);

fetch(indexUrl)
.then((response) => {
Expand Down
71 changes: 71 additions & 0 deletions libgit2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Updated Documentation (libgit2)
layout: default
---
<script>
if (window.location.hash) {
let version, path;

const referencePath = `/docs/reference`;
const components = window.location.hash.substr(1).split('/');

if (components[0]) {
version = components[0] === 'HEAD' ? 'main' : components[0];
}

if (components[1] === 'group') {
path = components.slice(2).join('/');
}
else if (components[1] === 'type') {
const type = components[2];
let group = type.replace(/^git_([^_]+).*/, "$1");

if (type === 'git_allocator' ||
type === 'git_commit_graph_writer_options' ||
type === 'git_config_backend' ||
type === 'git_config_backend_entry' ||
type === 'git_config_backend_memory_options' ||
type === 'git_config_iterator' ||
type === 'git_credential' ||
type === 'git_credential_userpass_plaintext' ||
type === 'git_credential_username' ||
type === 'git_credential_ssh_key' ||
type === 'git_credential_ssh_interactive' ||
type === 'git_credential_ssh_custom' ||
type === 'git_diff_perfdata' ||
type === 'git_fetch_negotiation' ||
type === 'git_filter_source' ||
type === 'git_filter' ||
type === 'git_hashsig' ||
type === 'git_index_name_entry' ||
type === 'git_index_reuc_entry' ||
type === 'git_merge_driver' ||
type === 'git_merge_driver_source' ||
type === 'git_odb_backend' ||
type === 'git_reference_iterator' ||
type === 'git_refdb_backend' ||
type === 'git_stream' ||
type === 'git_stream_registration' ||
type === 'git_transport' ||
type === 'git_smart_subtransport' ||
type === 'git_smart_subtransport_definition' ||
type === 'git_smart_subtransport_stream') {
group = `sys/${group}`;
}

path = `${group}/${type}`;
}

const url = path ? `${referencePath}/${version}/${path}` :
`${referencePath}/${version}`;

window.location.replace(url);
}
</script>

<h1>Updated Documentation</h1>

<p>
The documentation for libgit2 has been updated. Please visit
<a href="/docs/reference/">our reference documentation</a>.
</p>

0 comments on commit c4bfba6

Please sign in to comment.