diff --git a/packages/cli/src/assets/scripts/.gitignore b/packages/cli/src/assets/scripts/.gitignore
index a6c7c28..c3a2ac4 100644
--- a/packages/cli/src/assets/scripts/.gitignore
+++ b/packages/cli/src/assets/scripts/.gitignore
@@ -1 +1 @@
-*.js
+site.min.js
diff --git a/packages/cli/src/assets/scripts/iframehelper.min.js b/packages/cli/src/assets/scripts/iframehelper.min.js
new file mode 100644
index 0000000..81e863d
--- /dev/null
+++ b/packages/cli/src/assets/scripts/iframehelper.min.js
@@ -0,0 +1,20 @@
+document.addEventListener('DOMContentLoaded', function() {
+
+const myTitle = window.document.title;
+var element = document.getElementById('myInner');
+if (typeof(element) != 'undefined' && element != null) {
+ window.myInner.onload = function () {
+ //window.myDetails.open = false;
+ window.document.title = this.contentWindow.document.title + " - " + myTitle;
+ window.history.replaceState(null, null, "#" + this.contentWindow.location);
+ };
+
+ window.onhashchange = function () {
+ window.myInner.contentWindow.location = window.location.hash.startsWith("#")
+ ? window.location.hash.slice(1)
+ : "indexcontent.html";
+ }
+
+ window.onhashchange();
+}
+}, false);
diff --git a/packages/cli/src/commands/make-site.tsx b/packages/cli/src/commands/make-site.tsx
index ad28499..bc0ca2b 100644
--- a/packages/cli/src/commands/make-site.tsx
+++ b/packages/cli/src/commands/make-site.tsx
@@ -15,6 +15,7 @@ import * as path from "node:path";
import * as url from "node:url";
import fontAssetFilePath from "../assets/fonts/iosevka-aile-custom-light.woff2";
import scriptAssetFilePath from "../assets/scripts/site.min.js";
+import iframehelperAssetFilePath from "../assets/scripts/iframehelper.min.js";
import { printDiagnosticsAndExitOnError } from "../diagnostics.js";
import { Project } from "../model/project.js";
import { TextFile } from "../model/textfile.js";
@@ -36,6 +37,7 @@ const ERROR_FILE_NAME = "404.html";
const CSS_FILE_NAME = "style.css";
const FONT_FILE_NAME = path.basename(fontAssetFilePath);
const SCRIPT_FILE_NAME = path.basename(scriptAssetFilePath);
+const IFRAMEHELPER_FILE_NAME = path.basename(iframehelperAssetFilePath);
class Website implements RenderContext {
readonly dataset: ParsedTriple[][] = [];
@@ -124,7 +126,7 @@ class Website implements RenderContext {
}
}
-function renderIndex(context: Website, links: HtmlContent, scripts: HtmlContent, navigation: HtmlContent): HtmlContent {
+function renderWrapper(context: Website, links: HtmlContent, scripts: HtmlContent, navigation: HtmlContent): HtmlContent {
return
@@ -136,6 +138,21 @@ function renderIndex(context: Website, links: HtmlContent, scripts: HtmlContent,
+
+
+
+
+ ;
+}
+function renderIndex(context: Website, links: HtmlContent, scripts: HtmlContent, navigation: HtmlContent): HtmlContent {
+ return
+
+
+ {context.title}
+ {links}
+ {scripts}
+
+
{context.title}
@@ -202,6 +219,31 @@ function renderPage(iri: string, context: Website, links: HtmlContent, scripts:
;
}
+function renderNavlessPage(iri: string, context: Website, links: HtmlContent, scripts: HtmlContent): HtmlContent {
+ const subject: IRIOrBlankNode = iri.startsWith("http://example.com/.well-known/genid/")
+ ? BlankNode.create(iri.slice("http://example.com/.well-known/genid/".length))
+ : IRI.create(iri);
+
+ const prefixedName = context.lookupPrefixedName(subject.value);
+ const title = prefixedName ? prefixedName.prefixLabel + ":" + prefixedName.localName : "<" + subject.value + ">";
+
+ const main = renderMain(subject, iri in context.documents ? context.documents[iri] : null, context);
+
+ return
+
+
+ {title} – {context.title}
+ {links}
+ {scripts}
+
+
+
+ {main}
+
+
+ ;
+}
+
function resolveHref(url: string, base: string): string {
const root = new URL("/", base).href;
const result = new URL(url, base).href;
@@ -236,6 +278,7 @@ export default function main(options: Options): void {
const scripts = <>
+
>;
const navigation = renderNavigation(context.title, context);
@@ -243,6 +286,8 @@ export default function main(options: Options): void {
site.write(CSS_FILE_NAME, fs.readFileSync(path.format({ ...path.parse(moduleFilePath), base: "", ext: ".css" })));
site.write(FONT_FILE_NAME, fs.readFileSync(path.resolve(modulePath, fontAssetFilePath)));
site.write(SCRIPT_FILE_NAME, fs.readFileSync(path.resolve(modulePath, scriptAssetFilePath)));
+ site.write(IFRAMEHELPER_FILE_NAME, fs.readFileSync(path.resolve(modulePath, iframehelperAssetFilePath)));
+
for (const iconConfig of icons) {
site.write(path.basename(iconConfig.asset), project.package.read(iconConfig.asset));
@@ -252,10 +297,11 @@ export default function main(options: Options): void {
site.write(assets[assetPath], project.package.read(assetPath));
}
- site.write(INDEX_FILE_NAME, Buffer.from("\n" + renderHTML(renderIndex(context, links, scripts, navigation))));
+ site.write(INDEX_FILE_NAME, Buffer.from("\n" + renderHTML(renderWrapper(context, links, scripts, navigation))));
+ site.write("indexcontent.html", Buffer.from("\n" + renderHTML(renderIndex(context, links, scripts, navigation))));
site.write(ERROR_FILE_NAME, Buffer.from("\n" + renderHTML(render404(context, links, scripts, navigation))));
for (const iri in context.outputs) {
- site.write(context.outputs[iri] + ".html", Buffer.from("\n" + renderHTML(renderPage(iri, context, links, scripts, navigation))));
+ site.write(context.outputs[iri] + ".html", Buffer.from("\n" + renderHTML(renderNavlessPage(iri, context, links, scripts))));
}
}
diff --git a/packages/explorer-site/src/main.ts b/packages/explorer-site/src/main.ts
index 5dfb62f..1892f76 100644
--- a/packages/explorer-site/src/main.ts
+++ b/packages/explorer-site/src/main.ts
@@ -7,7 +7,15 @@ window.onclick = function (ev) {
if (!rel) {
ev.preventDefault();
if (href) {
- window.location.href = href;
+ /*
+ const myTitle = window.document.title;
+ window.document.title = this.contentWindow.document.title + " - " + myTitle;
+ window.history.replaceState(null, "", "#" + this.contentWindow.location);
+ */
+ if (window.location.hash.startsWith("#") ) {
+ var base = window.location.href.split('#')[0];
+ window.location.href = base + "#" + href;
+ }
}
}
break;
diff --git a/packages/explorer-views/src/pages/main.css b/packages/explorer-views/src/pages/main.css
index 26152fa..982c28f 100644
--- a/packages/explorer-views/src/pages/main.css
+++ b/packages/explorer-views/src/pages/main.css
@@ -63,3 +63,10 @@ strong {
font-weight: 600;
color: var(--base07);
}
+
+iframe {
+ border: none;
+ display: block;
+ height: 100%;
+ width: 100%;
+ }
\ No newline at end of file