Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions assets/js/src/marlin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Marlin, Environment } from "@docker/marlin-sdk-web-public";

const config = window.__marlinConfig;

if (config && config.apiKey && config.endpoint) {
try {
window.marlin = new Marlin({
endpoint: config.endpoint,
apiKey: config.apiKey,
site: "docs",
environment:
config.environment === "staging"
? Environment.STAGING
: Environment.PROD,
});
} catch (err) {
console.warn("Marlin SDK init failed:", err);
}
}
8 changes: 8 additions & 0 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ params:
google: GTM-WL2QLG5
onetrust: 65425fb0-7b36-4317-9f10-7b3e08039af0
vwo: 723167
marlin:
# Public-write API keys for the Marlin analytics SDK.
apiKey:
prod: mrl_2nuEKUo5bzRv8GcDKeYjij4J4U--OLdN
stage: mrl_W14SGEQ7nYmBsAyjZPyOM-nlgE53E-vX
endpoint:
prod: https://marlin-2.docker.com
stage: https://marlin-2-stage.docker.com

# Docs repository URL
repo: https://github.com/docker/docs
Expand Down
23 changes: 23 additions & 0 deletions layouts/_partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
{{ end }}
{{- with site.Params.analytics.marlin -}}
{{- $apiKey := "" -}}
{{- $endpoint := "" -}}
{{- $env := "" -}}
{{- if hugo.IsProduction -}}
{{- $apiKey = .apiKey.prod -}}
{{- $endpoint = .endpoint.prod -}}
{{- $env = "prod" -}}
{{- else if eq hugo.Environment "staging" -}}
{{- $apiKey = .apiKey.stage -}}
{{- $endpoint = .endpoint.stage -}}
{{- $env = "staging" -}}
{{- end -}}
{{- if and $apiKey $endpoint -}}
<script>
window.__marlinConfig = {
apiKey: {{ $apiKey | jsonify }},
endpoint: {{ $endpoint | jsonify }},
environment: {{ $env | jsonify }}
};
</script>
{{- end -}}
{{- end -}}
{{/* preload Roboto Flex as it's a critical font: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload */}}
<link
href="/assets/fonts/RobotoFlex.woff2"
Expand Down
8 changes: 4 additions & 4 deletions layouts/_partials/md-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="flex flex-wrap items-center gap-x-6 gap-y-2 text-sm">
<button
onclick="askGordon()"
data-heap-id="ask-gordon-button"
marlin-action="ask-gordon-button"
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
>
<span class="icon-svg icon-sm -translate-y-px">
Expand All @@ -13,7 +13,7 @@

<button
onclick="copyMarkdown()"
data-heap-id="copy-markdown-button"
marlin-action="copy-markdown-button"
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
>
<span class="icon-svg icon-sm">
Expand All @@ -27,7 +27,7 @@

<button
onclick="viewPlainText()"
data-heap-id="view-markdown-button"
marlin-action="view-markdown-button"
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
>
<span class="icon-svg icon-sm">
Expand All @@ -51,7 +51,7 @@
.then((text) => {
navigator.clipboard.writeText(text).then(() => {
const button = document.querySelector(
'[data-heap-id="copy-markdown-button"]',
'[marlin-action="copy-markdown-button"]',
);
if (!button) return;

Expand Down
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@alpinejs/collapse": "3.15.8",
"@alpinejs/focus": "3.15.8",
"@alpinejs/persist": "3.15.8",
"@docker/marlin-sdk-web-public": "0.2.0",
"@floating-ui/dom": "1.7.6",
"@tailwindcss/cli": "4.2.1",
"@tailwindcss/typography": "0.5.19",
Expand Down