Skip to content

Commit

Permalink
Try to fix js for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Jan 9, 2025
1 parent ec8d308 commit 9d1204b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 212 deletions.
191 changes: 0 additions & 191 deletions assets/js/howtos.js

This file was deleted.

4 changes: 3 additions & 1 deletion assets/js/tutorials.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import params from "@params";

const { TypesenseInstantSearchAdapter, instantsearch } = window;
const observer = lozad();

Expand Down Expand Up @@ -97,7 +99,7 @@ search.addWidgets([
templates: {
item: `
<div class="col tutorial hover-card {{resource}}">
<a href="{{relpermalink}}" target="_blank">
<a href="` + params.baseURL +`{{relpermalink}}" target="_blank">
{{#webm}}
<div class="hover-card-video">
<div>
Expand Down
8 changes: 0 additions & 8 deletions layouts/docs/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,5 @@

{{ partial "scripts.html" . }}

<script src="https://cdn.jsdelivr.net/npm/typesense-instantsearch-adapter@2/dist/typesense-instantsearch-adapter.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

{{ $jsTutorials := resources.Get "js/tutorials.js" }}
{{ $jsTutorials := $jsTutorials | minify }}
<script type="text/javascript" src="{{ $jsTutorials.RelPermalink }}" crossorigin="anonymous"></script>

</body>
</html>
10 changes: 10 additions & 0 deletions layouts/docs/tutorials.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ <h4 class="alert-heading">Javascript</h4>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

{{ $jsTutorials := resources.Get "js/tutorials.js" }}
{{ if (eq (substr .Site.BaseURL -1) "/" ) }}
{{- $opts := dict
"params" (dict "baseURL" (substr .Site.BaseURL 0 -1 ))
-}}
{{ else }}
{{- $opts := dict
"params" (dict "baseURL" .Site.BaseURL)
-}}
{{ end }}
{{- $jsTutorials = $jsTutorials | js.Build $opts -}}
{{ $jsTutorials := $jsTutorials | minify }}
<script type="text/javascript" src="{{ $jsTutorials.RelPermalink }}" crossorigin="anonymous"></script>

Expand Down
22 changes: 10 additions & 12 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,20 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

{{ $jsModels := resources.Get "js/models.js" }}
{{ if (eq (substr .Site.BaseURL -1) "/" ) }}
{{- $opts := dict
"params" (dict "baseURL" (substr .Site.BaseURL 0 -1 ))
-}}
{{ else }}
{{- $opts := dict
"params" (dict "baseURL" .Site.BaseURL)
-}}
{{ end }}
{{- $jsModels = $jsModels | js.Build $opts -}}
{{ $jsModels := $jsModels | minify }}
<script type="text/javascript" src="{{ $jsModels.RelPermalink }}" crossorigin="anonymous"></script>
{{ end }}

<!-- JS for how to page -->
{{ if .Page.Params.howtojs }}

<script src="https://cdn.jsdelivr.net/npm/typesense-instantsearch-adapter@2/dist/typesense-instantsearch-adapter.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

{{ $jsHowtos := resources.Get "js/howtos.js" }}
{{ $jsHowtos := $jsHowtos | minify }}
<script type="text/javascript" src="{{ $jsHowtos.RelPermalink }}" crossorigin="anonymous"></script>
{{ end }}

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script>
Expand Down

0 comments on commit 9d1204b

Please sign in to comment.