Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative urls #150

Merged
merged 2 commits into from
Sep 8, 2020
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
2 changes: 1 addition & 1 deletion bertytech/layouts/blog/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1 class="text-shadow">{{.Title}}</h1>
<div class="blog-tags mb-3 mb-0">
{{ range .Params.tags }}
{{ $tag := $.Site.GetPage (print "/tags/" .) }}
<a class="tag {{ . | lower }}" href="{{ $tag.Permalink }}">{{ $tag.Title }}</a>
<a class="tag {{ . | lower }}" href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
{{ end }}
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/fakepost/single.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ .Scratch.Set "body-class" "page-post wh page-fake" }}
{{ partial "head" . }}

<header class="header-rounded large {{ if .Params.Hclass }}{{.Params.Hclass}}{{ else }}bg-blue gradient{{ end }}" {{ with .Params.image_bg }}style="background-image:url('{{ ($.Page.Resources.GetMatch .).Permalink }}')"{{end}}>
<header class="header-rounded large {{ if .Params.Hclass }}{{.Params.Hclass}}{{ else }}bg-blue gradient{{ end }}" {{ with .Params.image_bg }}style="background-image:url('{{ ($.Page.Resources.GetMatch .).RelPermalink }}')"{{end}}>
<div class="container text-center">
<h1 class="text-shadow">{{.Title}}</h1>
</div><!-- /.container -->
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/faq/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3 class="text-shadow subtitle">{{.Params.Subtitle}}</h3>
<div class="container">

<section class="section-faq">
<amp-script class="row" layout="container" src="{{ (resources.Get `js/amp-faq.js`).Permalink }}">
<amp-script class="row" layout="container" src="{{ (resources.Get `js/amp-faq.js`).RelPermalink }}">
<div class="col-12">
{{ range sort .Pages "Params.id" }}
{{ partial "block_faq" . }}
Expand Down
4 changes: 2 additions & 2 deletions bertytech/layouts/jobs/single.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ .Scratch.Set "body-class" "page-post wh page-job" }}
{{ partial "head" . }}

<header class="header-rounded large bg-blue bg-image" {{ with .Params.image_bg }}style="background-image:url('{{ ($.Page.Resources.GetMatch .).Permalink }}')"{{end}}>
<header class="header-rounded large bg-blue bg-image" {{ with .Params.image_bg }}style="background-image:url('{{ ($.Page.Resources.GetMatch .).RelPermalink }}')"{{end}}>
<div class="container">
<div class="subnav">
<a class="btn btn-bty btn-transparent" href="/jobs"><i class="far fa-arrow-left"></i>Back to job offers</a>
Expand All @@ -22,7 +22,7 @@ <h3 class="text-shadow">{{.Params.location}}</h3>
{{ .Site.Params.jobsWorkingAtBerty | markdownify }}
<br />
<div class="buttons">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<a class="btn btn-bty btn-blue sendto-{{ `jobs@berty.tech` | base64Encode }}"><i class="fal fa-pencil-alt"></i>Apply to this offer</a>
</amp-script>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/partials/block_action_request_talk.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<a class="block block-action bg-blue bg-gradient bg-question sendto-{{ `hello@berty.tech` | base64Encode }} sendsubject-{{ `Request a talk` | base64Encode }}">
<h4><i class="fal fa-presentation left"></i>Request a talk<i class="far fa-chevron-right right"></i></h4>
</a><!-- /.block -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<a class="block block-action bg-blue bg-gradient bg-question sendto-{{ `hello@berty.tech` | base64Encode }} sendsubject-{{ `New FAQ question` | base64Encode }}">
<h4><i class="fal fa-question-circle left"></i>Suggest a question<i class="far fa-chevron-right right"></i></h4>
</a><!-- /.block -->
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/partials/footer_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ range $index, $el := index .ctx.Site.Menus .menu }}

{{ $isActive := or ($currentPage.IsMenuCurrent $.menu .) ($currentPage.HasMenuCurrent $.menu .) }}
{{ $isActive := or $isActive (in ($currentPage.Permalink | relLangURL) (.URL | relLangURL)) }}
{{ $isActive := or $isActive (in ($currentPage.RelPermalink | relLangURL) (.URL | relLangURL)) }}
<li {{if $isActive }}class="active"{{end}}><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
8 changes: 6 additions & 2 deletions bertytech/layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@
{{ $styleContent := replace $styleContent `@charset "UTF-8";` `` }} <!-- Reason for this line is because for an unknown reason it prefixes the CSS output with '@charset "UTF-8"' -->

{{ $segments := split (trim .RelPermalink "/") "/"}}
{{ $rel_path_prefix := apply $segments "print" ".." }}
{{ $rel_path_prefix = delimit $rel_path_prefix "/" }}
{{ $rel_path_prefix := "" }}
{{ if .IsHome }}
{{ $rel_path_prefix = "." }}
{{ else }}
{{ $rel_path_prefix = delimit (apply $segments "print" "..") "/" }}
{{ end }}

<style {{ if ($.Scratch.Get `isAmpPage`) }}amp-custom{{end}}>
/* Fontawesome */
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbar-links">

<amp-script layout="container" src="{{ (resources.Get `js/amp-navbar.js`).Permalink }}">
<amp-script layout="container" src="{{ (resources.Get `js/amp-navbar.js`).RelPermalink }}">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link" href="#" id="d-difference" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/partials/navbar_old.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ $isActive := or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
{{ $isActive := or $isActive (in ($currentPage.Permalink | relLangURL) (.URL | relLangURL)) }}
{{ $isActive := or $isActive (in ($currentPage.RelPermalink | relLangURL) (.URL | relLangURL)) }}
<li class="nav-item">
<a class="nav-link{{if $isActive }} active{{end}}" href="{{ .URL }}">{{ .Name }}</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions bertytech/layouts/shortcodes/display_directory_images.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<div class="col-md-3 col-6">
<!-- IMAGES DISPLAY -->
<div class="{{ $class }} block-dl-file">
<a href="{{ $image.Permalink }}" download="">
<a href="{{ $image.RelPermalink }}" download="">
<div class="dl-img">
{{ partial "img" (dict "ctx" . "src" ($scratch.Get `thumbnail`).Permalink "width" ($scratch.Get `width`) "height" ($scratch.Get `height`) )}}
{{ partial "img" (dict "ctx" . "src" ($scratch.Get `thumbnail`).RelPermalink "width" ($scratch.Get `width`) "height" ($scratch.Get `height`) )}}
</div>
<div class="hover">
<div class="btn btn-bty btn-blue">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h3>Contact us by email</h3>
<p><strong>If you wish to enhance email security</strong>, use PGP/GPG encryption technology:</p>
<div class="block-key">
<span class="left"><i class="far fa-envelope"></i>Email</span>
<amp-script class="right" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script class="right" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<span class="obsinner-{{ `secure@berty.tech` | base64Encode }}"></span>
</amp-script>
</div>
Expand All @@ -25,7 +25,7 @@ <h3>Contact us by email</h3>

<div class="block-key">
<span class="left"><i class="far fa-envelope"></i>Email</span>
<amp-script class="right" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script class="right" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<span class="obsinner-{{ `bertytech@protonmail.com` | base64Encode }}"></span>
</amp-script>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/shortcodes/display_section_press.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3>Image assets</h3>
{{- end }}
</div><!-- /.col -->
<div class="col-lg-4 col-md-6">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<div class= "block block-contact text-center">
<h3>Contact</h3>
<a class="h4 obsinner-{{ `press@berty.tech` | base64Encode }} sendto-{{ `press@berty.tech` | base64Encode }}"></a>
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/shortcodes/display_section_social.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2>Interact with us</h2>
</a>
</div>

<amp-script class="col-lg-3 col-md-6" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script class="col-lg-3 col-md-6" layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<a class="block block-value bg-white sendto-{{ `hello@berty.tech` | base64Encode }}">
<div class="block-value-icon c-blue"><i class="fal fa-envelope"></i></div>
<div class="block-value-text">Email us at&nbsp;<br/> <span class="c-blue to-text obsinner-{{ `hello@berty.tech` | base64Encode }}"></span></div>
Expand Down
2 changes: 1 addition & 1 deletion bertytech/layouts/shortcodes/img.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
{{ $scratch.Set "image" (($scratch.Get "image").Resize (print ($scratch.Get "width") "x" ($scratch.Get "height"))) }}
{{ end }}

{{ partial "img" (dict "ctx" . "class" $class "title" $title "alt" $alt "width" ($scratch.Get "width") "height" ($scratch.Get "height") "src" ($scratch.Get "image").Permalink )}}
{{ partial "img" (dict "ctx" . "class" $class "title" $title "alt" $alt "width" ($scratch.Get "width") "height" ($scratch.Get "height") "src" ($scratch.Get "image").RelPermalink )}}
2 changes: 1 addition & 1 deletion bertytech/layouts/shortcodes/obscure.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<span style="display: inline-flex;">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).Permalink }}">
<amp-script layout="flex-item" src="{{ (resources.Get `js/obs-email.js` | minify | fingerprint).RelPermalink }}">
<span class="obsinner-{{ .Get 0 | base64Encode }}">-</span>
</amp-script>
</span>