diff --git a/src/main.ts b/src/main.ts index 0eda53c2..9839497b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,6 +23,7 @@ function getElem( const sampleListElem = getElem('#samplelist'); const sampleElem = getElem('#sample'); +const githubElem = getElem('#src') as HTMLAnchorElement; const introElem = getElem('#intro'); const codeTabsElem = getElem('#codeTabs'); const sourcesElem = getElem('#sources'); @@ -130,6 +131,15 @@ function setSampleIFrame( sampleContainerElem.appendChild(el('iframe', { src })); sampleContainerElem.style.height = sources.length > 0 ? '600px' : '100%'; + if (url) { + // If it's remote example, hide the github link and assume it's in the description. + githubElem.style.display = 'none'; + } else { + // It's a local sample so show the github link. + githubElem.style.display = ''; + githubElem.href = `https://github.com/webgpu/webgpu-samples/tree/main/${filename}`; + } + // hide intro and show sample introElem.style.display = 'none'; sampleElem.style.display = '';