Skip to content

Commit

Permalink
fix zine devserver build & API Docs main page
Browse files Browse the repository at this point in the history
  • Loading branch information
renerocksai committed Feb 18, 2025
1 parent bd47d14 commit 808ee5a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 39 deletions.
2 changes: 1 addition & 1 deletion assets/zml_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
// navigate to this hash.
viewSourceHash: null,
};
var curNavSearch = "";
var curNavSearch = "zml";
var curSearchIndex = -1;
var imFeelingLucky = false;

Expand Down
10 changes: 6 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

// the zine dev server needs this option!!!
const opt_debug = b.option(bool, "debug", "zine debug, unused") orelse true;

const pcre2_dep = b.dependency("pcre2", .{
.target = target,
.optimize = optimize,
.@"code-unit-width" = .@"8",
});

const docs_wasm = try buildDocsWasm(b, optimize);
const website_step, const serve_step = try buildWebSite(b, docs_wasm);
const website_step, const serve_step = try buildWebSite(b, docs_wasm, opt_debug);
// has to be run with zig build website
_ = website_step;
// has to be run with zig build serve
Expand Down Expand Up @@ -51,15 +54,14 @@ fn buildDocsWasm(b: *std.Build, optimize: std.builtin.OptimizeMode) !*std.Build.
return docs_wasm;
}

fn buildWebSite(b: *std.Build, docs_wasm: *std.Build.Step.Compile) !struct {
fn buildWebSite(b: *std.Build, docs_wasm: *std.Build.Step.Compile, debug: bool) !struct {
*std.Build.Step,
*std.Build.Step,
} {
const site: zine.Site =
.{
.title = "ZML Documentation Website",
.host_url = "https://docs.zml.ai",
// .output_path_prefix = "web",
.content_dir_path = "content",
.layouts_dir_path = "layouts",
.assets_dir_path = "assets",
Expand Down Expand Up @@ -93,7 +95,7 @@ fn buildWebSite(b: *std.Build, docs_wasm: *std.Build.Step.Compile) !struct {
.install_always = true,
},
},
.debug = true,
.debug = debug,
};

// Setup debug flags if the user enabled Zine debug.
Expand Down
65 changes: 31 additions & 34 deletions layouts/templates/base.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<a id="logo" href="/"></a>
<nav id="menu">
<!-- burger menu -->
<button id="burger-menu" aria-label="Toggle Menu">&#9776;</button> <!-- Burger menu icon -->

<button id="burger-menu" aria-label="Toggle Menu">&#9776;</button>
<!-- Burger menu icon -->
<a href="/">Home</a>
<a href="$site.page('tutorials/getting_started').link()">Quickstart</a>
Expand All @@ -44,45 +44,42 @@
<a href="https://github.com/zml/zml" target="_blank">Code</a>
<a href="https://discord.gg/6y72SN2E7H" target="_blank">Discord</a>


</nav>
<!-- <hr style="width:min(600px, 100vw); border-color:#0798b3; color: white; border-top:1px;"> -->
<aside id="sidebar" class="sidebar">
<!-- <h3>Docs</h3> -->
<a href="$site.page('tutorials').link()"><h5>Tutorials</h5></a>
<div class="linkbox" :loop="$site.page('tutorials').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('howtos').link()"><h5>How-Tos</h5></a>
<div class="linkbox" :loop="$site.page('howtos').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('tutorials').link()"><h5>Learn more</h5></a>
<div class="linkbox" :loop="$site.page('learn').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('tutorials').link()"><h5>Misc</h5></a>
<div class="linkbox" :loop="$site.page('misc').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<!-- <h3>Docs</h3> -->
<a href="$site.page('tutorials').link()"><h5>Tutorials</h5></a>
<div class="linkbox" :loop="$site.page('tutorials').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('howtos').link()"><h5>How-Tos</h5></a>
<div class="linkbox" :loop="$site.page('howtos').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('tutorials').link()"><h5>Learn more</h5></a>
<div class="linkbox" :loop="$site.page('learn').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
<a href="$site.page('tutorials').link()"><h5>Misc</h5></a>
<div class="linkbox" :loop="$site.page('misc').subpages()">
<div><a href="$loop.it.link()" :text="$loop.it.title"></a></div>
</div>
</aside>

<main>
<div id="content"><super></div>
<div id="content"><super></div>
</main>


<footer>
<!-- OPTION 1: with Zine -->
<b>&copy; in 2024 by <a href="https://zml.ai" target="_blank">ZML.ai</a> </b> — <i>made with <a href="https://zine-ssg.io" target="_blank">Zine</a></i>

<!-- OPTION 2: ZML only -->
<!-- &copy; in 2024 by <a href="https://zml.ai" target="_blank">ZML.ai</a> -->
<!-- OPTION 1: with Zine -->
<b>&copy; in 2024 by
<a href="https://zml.ai" target="_blank">ZML.ai</a></b>
<i>made with
<a href="https://zine-ssg.io" target="_blank">Zine</a></i>
<!-- OPTION 2: ZML only -->
<!-- &copy; in 2024 by <a href="https://zml.ai" target="_blank">ZML.ai</a> -->
</footer>

<!-- burger menu script -->
<script>
<!-- burger menu script -->
<script>
document.getElementById('burger-menu').addEventListener('click', function() {
const sidebar = document.getElementById('sidebar');
const logo = document.getElementById('logo');
Expand All @@ -95,6 +92,6 @@
// Toggle the 'show-sidebar' class on the body to adjust the grid layout
body.classList.toggle('show-sidebar');
});
</script>
</script>
</body>
</html>

0 comments on commit 808ee5a

Please sign in to comment.