mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-02-07 06:19:03 +00:00
Limit external link styling
This commit is contained in:
parent
8f3cd78b1a
commit
4d47f5192a
@ -36,30 +36,6 @@ article {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Select all links that are external.
|
|
||||||
|
|
||||||
In this case, we'll just exclude all links that are...
|
|
||||||
|
|
||||||
- All internal anchors.
|
|
||||||
- All links that points to a relative path.
|
|
||||||
- All origin-relative URLs.
|
|
||||||
|
|
||||||
Also, all links that are explicitly marked as external are obviously
|
|
||||||
considered.
|
|
||||||
*/
|
|
||||||
a[href]:not(:where(
|
|
||||||
a[href^="#"],
|
|
||||||
a[href^="./"],
|
|
||||||
a[href^="../"],
|
|
||||||
a[href^="/"]:not(a[href^="//"]),
|
|
||||||
))::after, a[rel~="external"]::after {
|
|
||||||
color: var(--base05);
|
|
||||||
font-size: 0.50em;
|
|
||||||
content: " [🡕]";
|
|
||||||
vertical-align: super;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Text formatting */
|
/* Text formatting */
|
||||||
h1, h2, h3,
|
h1, h2, h3,
|
||||||
h4, h5, h6 {
|
h4, h5, h6 {
|
||||||
|
@ -2,14 +2,40 @@
|
|||||||
This is a site-specific styling that have to be generated.
|
This is a site-specific styling that have to be generated.
|
||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
/* Internal links are not to be styled. */
|
article > main {
|
||||||
{{- $baseURL := urls.Parse $.Site.BaseURL }}
|
/*
|
||||||
a[href]:where(
|
Select all links that are external.
|
||||||
a[href^="http://{{- $baseURL.Host -}}"],
|
|
||||||
a[href^="https://{{- $baseURL.Host -}}"],
|
In this case, we'll just exclude all links that are...
|
||||||
a[href$="{{- $baseURL.Host -}}"],
|
|
||||||
a[href$="{{- $baseURL.Host -}}/"],
|
- All internal anchors.
|
||||||
a[href^="{{- $.Site.BaseURL -}}"],
|
- All links that points to a relative path.
|
||||||
)::after {
|
- All origin-relative URLs.
|
||||||
content: unset;
|
|
||||||
|
Also, all links that are explicitly marked as external are obviously
|
||||||
|
considered.
|
||||||
|
*/
|
||||||
|
a[href]:not(:where(
|
||||||
|
a[href^="#"],
|
||||||
|
a[href^="./"],
|
||||||
|
a[href^="../"],
|
||||||
|
a[href^="/"]:not(a[href^="//"]),
|
||||||
|
))::after, a[rel~="external"]::after {
|
||||||
|
color: var(--base05);
|
||||||
|
font-size: 0.50em;
|
||||||
|
content: " [🡕]";
|
||||||
|
vertical-align: super;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Internal links are not to be styled. */
|
||||||
|
{{- $baseURL := urls.Parse $.Site.BaseURL }}
|
||||||
|
a[href]:where(
|
||||||
|
a[href^="http://{{- $baseURL.Host -}}"],
|
||||||
|
a[href^="https://{{- $baseURL.Host -}}"],
|
||||||
|
a[href$="{{- $baseURL.Host -}}"],
|
||||||
|
a[href$="{{- $baseURL.Host -}}/"],
|
||||||
|
a[href^="{{- $.Site.BaseURL -}}"],
|
||||||
|
)::after {
|
||||||
|
content: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<section>
|
<article>
|
||||||
{{ .Content }}
|
<main>{{- .Content }}</main>
|
||||||
</section>
|
|
||||||
|
|
||||||
{{- /* The homepage should show only pages from the given sections (with `$.Site.Params.mainSections`).
|
{{- /* The homepage should show only pages from the given sections (with `$.Site.Params.mainSections`).
|
||||||
Otherwise, we take the pages of a section. */ -}}
|
Otherwise, we take the pages of a section. */ -}}
|
||||||
@ -18,4 +17,5 @@ Otherwise, we take the pages of a section. */ -}}
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- partial "pagination.html" (dict "Paginator" .Paginator "activeNumberOfPages" 2) }}
|
{{- partial "pagination.html" (dict "Paginator" .Paginator "activeNumberOfPages" 2) }}
|
||||||
|
</article>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user