Skip to content

Commit

Permalink
Use relative URLs. Fixes #162.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsegura committed Jul 5, 2024
1 parent 6ae6c5d commit 589a5ff
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ define "main" }}

<section>
<img class="homepage-banner no-mobile" src="{{ .Site.BaseURL }}/images/homepage-banner.jpg">
<img class="homepage-banner no-desktop" src="{{ .Site.BaseURL }}/images/homepage-banner-mobile.jpg">
<img class="homepage-banner no-mobile" src="{{ relURL "images/homepage-banner.jpg" }}">
<img class="homepage-banner no-desktop" src="{{ relURL "images/homepage-banner-mobile.jpg" }}">
<div class="homepage-banner--headline text-center">
<h2 class="h2">{{ i18n "headline" | safeHTML }}</h2>
<div class="row">
Expand All @@ -11,7 +11,7 @@ <h2 class="h2">{{ i18n "headline" | safeHTML }}</h2>
{{ i18n "ecosystem.content" | safeHTML }}
</p>
<div class="text-center">
<a href="{{ ref . (printf "%s%s%s" "federation." .Lang ".md") }}" class="btn">{{ i18n "discover" | safeHTML }}</a>
<a href="{{ ref . (printf "%s%s%s" "federation." .Lang ".md") | relURL }}" class="btn">{{ i18n "discover" | safeHTML }}</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -51,7 +51,7 @@ <h4 class="h4 text-center text-info"><i class="fa fa-cutlery"></i>  {{ i18n "s
{{ $appStoreBadge = index $.Site.Data.app_store_badges .Lang }}
{{ end }}
<img alt="{{ i18n "app.appStore" }}"
src="{{ .Site.BaseURL }}/{{ $appStoreBadge }}" />
src="{{ relURL $appStoreBadge }}" />
</a>
</div>
</div>
Expand All @@ -71,7 +71,7 @@ <h4 class="h4 text-center">{{ i18n "digital_common.title" }}</h4>
</p>
</div>
<div class="col-md-6 text-center">
<a href="{{ ref . (printf "%s%s%s" "software." .Lang ".md") }}" class="btn">{{ i18n "discover.software" | safeHTML }}</a>
<a href="{{ ref . (printf "%s%s%s" "software." .Lang ".md") | relURL }}" class="btn">{{ i18n "discover.software" | safeHTML }}</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -116,7 +116,7 @@ <h4 class="h4 text-center">{{ i18n "association.title" }}</h4>

{{ define "scripts" }}
{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<script src="{{ .Site.BaseURL }}js/homepage.js" type="application/javascript"></script>
<script src="{{ relURL "js/homepage.js" }}" type="application/javascript"></script>
{{ else }}
<script src="/{{ index $.Site.Data.manifest "homepage.js" }}" type="application/javascript"></script>
{{ end }}
Expand Down
28 changes: 14 additions & 14 deletions themes/coopcycle/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Raleway:400,700">

{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<link href="{{ .Site.BaseURL }}css/style.css" rel="stylesheet">
<link href="{{ relURL "css/style.css" }}" rel="stylesheet">
{{ else }}
<link href="/{{ index $.Site.Data.manifest "style.css" }}" rel="stylesheet">
{{ end }}
Expand Down Expand Up @@ -48,17 +48,17 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="{{ "/" | absLangURL }}">
<img src="{{ .Site.BaseURL }}/images/logo.svg" width="40" height="40" alt="{{ i18n "home" }}" class="d-inline-block align-top">
<a class="navbar-brand" href="{{ "/" | relLangURL }}">
<img src="{{ relURL "images/logo.svg" }}" width="40" height="40" alt="{{ i18n "home" }}" class="d-inline-block align-top">
<span class="no-mobile brand-name">CoopCycle</span>
</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav navbar-nav__pages ml-auto">
{{- $currentURL := .RelPermalink | absLangURL -}}
{{- $currentURL := .RelPermalink | relLangURL -}}
{{ range .Site.Menus.main }}
{{ $menuURL := .URL | absLangURL }}
{{ $menuURL := .URL | relLangURL }}
<li class="nav-item {{ if eq $menuURL $currentURL }}active{{ end }}">
<a class="nav-link" href="{{ .URL | absURL }}">{{ .Pre }}{{ .Name }}{{ .Post }}</a>
<a class="nav-link" href="{{ .URL | relURL }}">{{ .Pre }}{{ .Name }}{{ .Post }}</a>
</li>
{{ end }}
</ul>
Expand All @@ -70,7 +70,7 @@
<ul class="navbar-nav mobile-trad no-desktop">
{{ range .Translations }}
<li class="nav-item">
<a class="nav-link" href="{{ .Permalink }}">{{ index $.Site.Data.languages .Lang }}</a>
<a class="nav-link" href="{{ .Permalink | relURL }}">{{ index $.Site.Data.languages .Lang }}</a>
</li>
{{ end }}
</ul>
Expand All @@ -89,7 +89,7 @@
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
{{ range .Translations }}
<li class="dropdown-item">
<a href="{{ .Permalink }}">{{ index $.Site.Data.languages .Lang }}</a>
<a href="{{ .Permalink | relURL }}">{{ index $.Site.Data.languages .Lang }}</a>
</li>
{{ end }}
</ul>
Expand Down Expand Up @@ -142,7 +142,7 @@
</ul>

<div class="d-flex align-items-center justify-content-center my-2">
<img src="{{ .Site.BaseURL }}/images/european-flag-lowres.jpg" width="80" class="mr-2">
<img src="{{ relURL "images/european-flag-lowres.jpg" }}" width="80" class="mr-2">
<div class="text-left">
<strong class="d-block">{{ i18n "footer.cofundedByEU" | safeHTML }}</strong>
<span>NextGenerationEU</span>
Expand All @@ -152,14 +152,14 @@
{{ $crops4life := .Site.GetPage "crops4life" }}
{{ if $crops4life }}
<section class="mb-2">
<a href="{{ $crops4life.Permalink }}" class="text-white">{{ i18n "footer.crops4life" | safeHTML }}</a>
<a href="{{ $crops4life.Permalink | relURL }}" class="text-white">{{ i18n "footer.crops4life" | safeHTML }}</a>
</section>
{{ end }}

<section class="d-flex align-items-center justify-content-center my-2">
<div>
<img src="{{ .Site.BaseURL }}/svg/ademe.svg" width="60" class="mr-2">
<img src="{{ .Site.BaseURL }}/svg/france-relance.svg" width="60" class="mr-2">
<img src="{{ relURL "svg/ademe.svg" }}" width="60" class="mr-2">
<img src="{{ relURL "svg/france-relance.svg" }}" width="60" class="mr-2">
</div>
<div class="text-left">
{{ i18n "footer.ademe_france_relance" | safeHTML }}
Expand All @@ -170,7 +170,7 @@
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="mailto:[email protected]">[email protected]</a>
<a class="nav-link" href="{{ $legal.Permalink }}">{{ $legal.Title }}</a>
<a class="nav-link" href="{{ $legal.Permalink | relURL }}">{{ $legal.Title }}</a>
</li>
</ul>

Expand All @@ -188,7 +188,7 @@
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<script src="{{ .Site.BaseURL }}js/index.js" type="application/javascript"></script>
<script src="{{ relURL "js/index.js" }}" type="application/javascript"></script>
{{ else }}
<script src="/{{ index $.Site.Data.manifest "index.js" }}" type="application/javascript"></script>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion themes/coopcycle/layouts/federation/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2 class="h2">{{ i18n "network.title" }}</h2>

{{ define "scripts" }}
{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<script src="{{ .Site.BaseURL }}js/federation.js" type="application/javascript"></script>
<script src="{{ relURL "js/federation.js" }}" type="application/javascript"></script>
{{ else }}
<script src="/{{ index $.Site.Data.manifest "federation.js" }}" type="application/javascript"></script>
{{ end }}
Expand Down
8 changes: 4 additions & 4 deletions themes/coopcycle/layouts/mexico/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

{{ define "main" }}
<section>
<img class="homepage-banner no-mobile" src="{{ .Site.BaseURL }}/images/homepage-banner.jpg">
<img class="homepage-banner no-desktop" src="{{ .Site.BaseURL }}/images/homepage-banner-mobile.jpg">
<img class="homepage-banner no-mobile" src="{{ relURL "images/homepage-banner.jpg" }}">
<img class="homepage-banner no-desktop" src="{{ relURL "images/homepage-banner-mobile.jpg" }}">
<div class="homepage-banner--headline text-center">
<h2 class="h2"> CoopCycle México </h2>
<div class="row">
Expand Down Expand Up @@ -88,7 +88,7 @@ <h5 class="text-center">{{ .name }}</h5>
{{ $appStoreBadge = index $.Site.Data.app_store_badges .Lang }}
{{ end }}
<img alt="{{ i18n "app.appStore" }}"
src="{{ .Site.BaseURL }}/{{ $appStoreBadge }}" />
src="{{ relURL $appStoreBadge }}" />
</a>
</div>

Expand All @@ -110,7 +110,7 @@ <h5 class="text-center">{{ .name }}</h5>

{{ define "scripts" }}
{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<script src="{{ .Site.BaseURL }}js/landingpagemexico.js?t={{ now.Unix }}" type="application/javascript"></script>
<script src="{{ relURL "js/landingpagemexico.js?t={{ now.Unix }}" }}" type="application/javascript"></script>
{{ else }}
<script src="/{{ index $.Site.Data.manifest "landingpagemexico.js" }}" type="application/javascript"></script>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion themes/coopcycle/layouts/order/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

{{ define "scripts" }}
{{ if eq (printf "%v" $.Site.BaseURL) "http://localhost:1313/" }}
<script type="application/javascript" src="{{ .Site.BaseURL }}js/order.js"></script>
<script type="application/javascript" src="{{ relURL "js/order.js" }}"></script>
{{ else }}
<script type="application/javascript" src="/{{ index $.Site.Data.manifest "order.js" }}"></script>
{{ end }}
Expand Down

0 comments on commit 589a5ff

Please sign in to comment.