aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <mail@nicholasjohnson.ch>2024-11-08 00:00:00 +0000
committerNicholas Johnson <mail@nicholasjohnson.ch>2024-11-08 00:00:00 +0000
commit9057f651fb508edf0e0488df590ed119d08a28b5b8860c7eedd1190eb6e5f571 (patch)
treeea976f6e5f4339bdf376de832f73bd00612f0cc6320d2031ce92cbbcfd06ce0b
parent9b5a1119d7c0b381be13a329e58388f76637d456d4b0de4c54e2ce2bafaf74a7 (diff)
downloadhugo-theme-journal-9057f651fb508edf0e0488df590ed119d08a28b5b8860c7eedd1190eb6e5f571.tar.gz
hugo-theme-journal-9057f651fb508edf0e0488df590ed119d08a28b5b8860c7eedd1190eb6e5f571.zip
Change CSS styling for external links
-rw-r--r--assets/style.css16
-rw-r--r--layouts/404.html2
-rw-r--r--layouts/_default/_markup/render-link.html3
-rw-r--r--layouts/_default/single.html2
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/metadata.html2
-rw-r--r--layouts/partials/pageinfo.html2
-rw-r--r--layouts/taxonomy/taxonomy.html6
-rw-r--r--layouts/term/term.html4
9 files changed, 26 insertions, 13 deletions
diff --git a/assets/style.css b/assets/style.css
index 5bd6b33..81ea8bd 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -115,15 +115,27 @@ blockquote, ol, p, pre, ul, .highlight {
}
.link {
- color: #0091ea;
text-underline-offset: 3px;
}
-.link:hover {
+.link--internal {
+ color: #0091ea;
+}
+
+.link--internal:hover {
background-color: #0091ea;
color: black;
}
+.link--external {
+ color: #9370DB;
+}
+
+.link--external:hover {
+ background-color: #9370DB;
+ color: black;
+}
+
.list {
list-style: none;
padding-left: 0;
diff --git a/layouts/404.html b/layouts/404.html
index 6100aa9..dfb2c5f 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -1,6 +1,6 @@
{{ define "main" -}}
<nav>
- <p>{{ emojify ":link:" }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
+ <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
</nav>
<main>
<h1 id="404">{{ i18n "pageNotFound" }}</h1>
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index 6cadaec..8fb3c26 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -1,2 +1,3 @@
{{ $emoji := cond (and (not (.Page.Params.makerefs | default true)) (.Page.Params.showlinkemoji | default true)) (emojify ":link: ") "" -}}
-{{ $emoji }}<a class="link" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }} rel="{{ if (urls.Parse .Destination).IsAbs }}external {{ end }}noreferrer">{{ .Text }}</a> \ No newline at end of file
+{{ $isExternalLink := (urls.Parse .Destination).IsAbs -}}
+{{ $emoji }}<a class="link {{ if $isExternalLink }}link--external{{ else }}link--internal{{ end }}" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }} rel="{{ if $isExternalLink }}external {{ end }}noreferrer">{{ .Text }}</a> \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 1bc79e4..1a8aa10 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,6 +1,6 @@
{{ define "main" -}}
<nav>
- <p>{{ emojify ":link:" }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
+ <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
</nav>
{{- if (.Page.Params.pageinfo | default true) }}
<p>{{ partial "pageinfo.html" . }}</p>
diff --git a/layouts/index.html b/layouts/index.html
index 398a770..c5ba561 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -7,7 +7,7 @@
<nav>
<ul class="list">
{{- range .Site.Menus.main }}
- <li class="list__item">{{ emojify ":link:" }} <a class="link" href="{{ .URL }}" rel="noreferrer">{{ .Name }}</a></li>
+ <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .URL }}" rel="noreferrer">{{ .Name }}</a></li>
{{- end }}
</ul>
</nav>
diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html
index 47106e8..4158ee5 100644
--- a/layouts/partials/metadata.html
+++ b/layouts/partials/metadata.html
@@ -1,6 +1,6 @@
<article>
<header>
<p>{{ partial "pageinfo.html" . }}<br>
- {{ emojify ":link:" }} <a class="link" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></p>
+ {{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></p>
</header>
</article> \ No newline at end of file
diff --git a/layouts/partials/pageinfo.html b/layouts/partials/pageinfo.html
index 4c0e855..c002530 100644
--- a/layouts/partials/pageinfo.html
+++ b/layouts/partials/pageinfo.html
@@ -1,2 +1,2 @@
{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}}
-{{ emojify ":calendar:" }} <time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ .Page.PublishDate | time.Format $dateFormat }}</time> | {{ emojify ":stopwatch:" }} <time datetime="PT{{ .ReadingTime }}M">{{ i18n "readingTime" .ReadingTime }}</time>{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}<a class="link" href='{{ relLangURL (lower (i18n "tags")) }}/{{ . | urlize }}/' rel="noreferrer">{{ $val }}</a>{{ end }}
+{{ emojify ":calendar:" }} <time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ .Page.PublishDate | time.Format $dateFormat }}</time> | {{ emojify ":stopwatch:" }} <time datetime="PT{{ .ReadingTime }}M">{{ i18n "readingTime" .ReadingTime }}</time>{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}<a class="link link--internal" href='{{ relLangURL (lower (i18n "tags")) }}/{{ . | urlize }}/' rel="noreferrer">{{ $val }}</a>{{ end }}
diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html
index 77475de..7dd447d 100644
--- a/layouts/taxonomy/taxonomy.html
+++ b/layouts/taxonomy/taxonomy.html
@@ -1,15 +1,15 @@
{{ define "main" -}}
<nav>
- <p>{{ emojify ":link:" }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
+ <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
</nav>
<main>
<h1>{{ .Type | humanize }}</h1>
<h2>{{ i18n "feeds" }}</h2>
- <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" }} {{ i18n "atomFeed" }}</a></p>
+ <p><a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" }} {{ i18n "atomFeed" }}</a></p>
<h2>{{ i18n "list" }}</h2>
<ul class="list">
{{- range .Data.Pages }}
- <li class="list__item">{{ emojify ":link:" }} <a class="link" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li>
+ <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li>
{{- end }}
</ul>
</main>
diff --git a/layouts/term/term.html b/layouts/term/term.html
index 5519ba2..33d5347 100644
--- a/layouts/term/term.html
+++ b/layouts/term/term.html
@@ -1,11 +1,11 @@
{{ define "main" -}}
<nav>
- <p>{{ emojify ":link:" }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
+ <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p>
</nav>
<main>
<h1>{{ .Type | singularize | humanize }} "{{ .Title }}"</h1>
<h2>{{ i18n "feeds" }}</h2>
- <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" }} {{ i18n "atomFeed" }}</a></p>
+ <p><a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" }} {{ i18n "atomFeed" }}</a></p>
<h2>{{ i18n "journalEntries" }}</h2>
{{- range .Data.Pages.ByPublishDate.Reverse }}
{{ partial "metadata.html" . -}}