Skip to content

Commit e686359

Browse files
committed
Revert "trying to use absolute path to assets"
This reverts commit 18a31b7.
1 parent 18a31b7 commit e686359

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

scripts/utility.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ const renderTemplate = (template, vars, currentPageInfo) => {;
4646
return template
4747
}
4848

49-
// Gets the relative path to the source dir from a docs page
49+
// Gets the relative path to the source dir from a docs page, returning a web-safe path
5050
const getRelativeRootFromPage = (pagePath) => {
5151
let depth = dirDepth(pagePath) - dirDepth(Path.resolve(CONFIG.sourceDir))
52-
let relPath = ('..' + Path.sep).repeat(depth - 1)
53-
54-
return relPath;
52+
if (depth <= 1) return './';
53+
let relPath = '../'.repeat(depth - 1);
54+
return relPath.replace(/\/+$/, '') + '/';
5555
}
5656

5757
// Returns a function that will slugify a heading and also handle future duplicate slugs when called again

theme/doc-page-template.html

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616

1717
<link rel="stylesheet" href="https://unpkg.com/meilisearch-docsearch@latest/dist/index.css"/>
1818

19-
<link rel="stylesheet" href="/_assets/default.min.css">
19+
<link rel="stylesheet" href="{{root_dir}}_assets/default.min.css">
2020

2121
<!-- Favicons -->
22-
<link rel="apple-touch-icon" sizes="57x57" href="/_assets/images/favicons/apple-icon-57x57.png">
23-
<link rel="apple-touch-icon" sizes="60x60" href="/_assets/images/favicons/apple-icon-60x60.png">
24-
<link rel="apple-touch-icon" sizes="72x72" href="/_assets/images/favicons/apple-icon-72x72.png">
25-
<link rel="apple-touch-icon" sizes="76x76" href="/_assets/images/favicons/apple-icon-76x76.png">
26-
<link rel="apple-touch-icon" sizes="114x114" href="/_assets/images/favicons/apple-icon-114x114.png">
27-
<link rel="apple-touch-icon" sizes="120x120" href="/_assets/images/favicons/apple-icon-120x120.png">
28-
<link rel="apple-touch-icon" sizes="144x144" href="/_assets/images/favicons/apple-icon-144x144.png">
29-
<link rel="apple-touch-icon" sizes="152x152" href="/_assets/images/favicons/apple-icon-152x152.png">
30-
<link rel="apple-touch-icon" sizes="180x180" href="/_assets/images/favicons/apple-icon-180x180.png">
31-
<link rel="icon" type="image/png" sizes="192x192" href="/_assets/images/favicons/android-icon-192x192.png">
32-
<link rel="icon" type="image/png" sizes="32x32" href="/_assets/images/favicons/favicon-32x32.png">
33-
<link rel="icon" type="image/png" sizes="96x96" href="/_assets/images/favicons/favicon-96x96.png">
34-
<link rel="icon" type="image/png" sizes="16x16" href="/_assets/images/favicons/favicon-16x16.png">
35-
<link rel="manifest" href="/_assets/images/favicons/manifest.json">
22+
<link rel="apple-touch-icon" sizes="57x57" href="{{root_dir}}_assets/images/favicons/apple-icon-57x57.png">
23+
<link rel="apple-touch-icon" sizes="60x60" href="{{root_dir}}_assets/images/favicons/apple-icon-60x60.png">
24+
<link rel="apple-touch-icon" sizes="72x72" href="{{root_dir}}_assets/images/favicons/apple-icon-72x72.png">
25+
<link rel="apple-touch-icon" sizes="76x76" href="{{root_dir}}_assets/images/favicons/apple-icon-76x76.png">
26+
<link rel="apple-touch-icon" sizes="114x114" href="{{root_dir}}_assets/images/favicons/apple-icon-114x114.png">
27+
<link rel="apple-touch-icon" sizes="120x120" href="{{root_dir}}_assets/images/favicons/apple-icon-120x120.png">
28+
<link rel="apple-touch-icon" sizes="144x144" href="{{root_dir}}_assets/images/favicons/apple-icon-144x144.png">
29+
<link rel="apple-touch-icon" sizes="152x152" href="{{root_dir}}_assets/images/favicons/apple-icon-152x152.png">
30+
<link rel="apple-touch-icon" sizes="180x180" href="{{root_dir}}_assets/images/favicons/apple-icon-180x180.png">
31+
<link rel="icon" type="image/png" sizes="192x192" href="{{root_dir}}_assets/images/favicons/android-icon-192x192.png">
32+
<link rel="icon" type="image/png" sizes="32x32" href="{{root_dir}}_assets/images/favicons/favicon-32x32.png">
33+
<link rel="icon" type="image/png" sizes="96x96" href="{{root_dir}}_assets/images/favicons/favicon-96x96.png">
34+
<link rel="icon" type="image/png" sizes="16x16" href="{{root_dir}}_assets/images/favicons/favicon-16x16.png">
35+
<link rel="manifest" href="{{root_dir}}_assets/images/favicons/manifest.json">
3636
<meta name="msapplication-TileColor" content="#ffffff">
37-
<meta name="msapplication-TileImage" content="/_assets/images/favicons/ms-icon-144x144.png">
37+
<meta name="msapplication-TileImage" content="{{root_dir}}_assets/images/favicons/ms-icon-144x144.png">
3838
<meta name="theme-color" content="#ffffff">
3939

4040
<style>
@@ -56,7 +56,7 @@
5656
<body>
5757
<div class="header">
5858
<div class="header-content">
59-
<a href="https://docs.expressionengine.com/latest" class="header-logo"><img src="/_assets/images/ee-logo-white.svg" alt=""></a>
59+
<a href="https://docs.expressionengine.com/latest" class="header-logo"><img src="{{root_dir}}_assets/images/ee-logo-white.svg" alt=""></a>
6060
<a href="https://docs.expressionengine.com/latest" class="header-title">ExpressionEngine Docs</a>
6161

6262
<nav>
@@ -82,7 +82,7 @@
8282
</div>
8383
</div>
8484
</div>
85-
<a href="https://docs.expressionengine.com/downloads/EEDocs7.latest.zip" class="download-button"><img src="/_assets/images/download.svg" alt=""></a>
85+
<a href="https://docs.expressionengine.com/downloads/EEDocs7.latest.zip" class="download-button"><img src="{{root_dir}}_assets/images/download.svg" alt=""></a>
8686
</div>
8787
</nav>
8888

@@ -91,6 +91,8 @@
9191
</div>
9292
</div>
9393
</div>
94+
<p style="display: none;">root_dir - {{root_dir}}</p>
95+
9496
<div class="sidebar-container">
9597
<div class="sidebar">
9698
<div class="sidebar-search" id="docsearch">
@@ -142,6 +144,6 @@ <h2>Community</h2>
142144
});
143145
</script>
144146

145-
<script src="/_assets/main.min.js"></script>
147+
<script src="{{root_dir}}_assets/main.min.js"></script>
146148
</body>
147149
</html>

0 commit comments

Comments
 (0)