Skip to content

Commit 25bcaf5

Browse files
authored
feat: Report issues on pages directly from sidemenu (#97)
## Description Add a link to report issues directly in the sidemenu. Corresponding labels are auto-added to the report. Depends on #96. Do not merge before #96 is merged! The content was modified in the following languages: <!-- Der Inhalt wurde für die folgenden Sprachen angepasst --> - [x] English - [x] German
1 parent 310596a commit 25bcaf5

File tree

8 files changed

+43
-6
lines changed

8 files changed

+43
-6
lines changed

assets/sass/fonts.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
font-weight: 400;
6767
src: url(@fontsource/material-symbols-rounded/files/material-symbols-rounded-latin-400-normal.woff2) format('woff2'), url(@fontsource/material-symbols-rounded/files/material-symbols-rounded-latin-400-normal.woff) format('woff');
6868
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
69+
font-display: block; // Do not display icons until font is fully loaded
6970
}
7071

7172
body {
@@ -79,7 +80,7 @@ body {
7980
font-weight: normal;
8081
font-style: normal;
8182
display: inline-block;
82-
font-size: 20px;
83+
font-size: 2rem;
8384
line-height: 1;
8485
text-transform: none;
8586
letter-spacing: normal;
@@ -88,4 +89,6 @@ body {
8889
direction: ltr;
8990
vertical-align: text-bottom;
9091
text-decoration: none;
92+
width: 1em;
93+
height: 1em;
9194
}

hugo.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ markup:
3636
tableOfContents:
3737
startLevel: 2
3838
endLevel: 2
39+
goldmark:
40+
renderer:
41+
# https://gohugo.io/configuration/markup/#rendererunsafe
42+
# Safe rendering does omit some styles to prevent XSS,
43+
# but since our content is in our control,
44+
# we can disable safe rendering.
45+
unsafe: true
46+
3947

4048
cascade:
4149
toc: true # enable toc for all pages
@@ -44,3 +52,4 @@ cascade:
4452

4553
params:
4654
githubDevUrl: 'https://github.dev/fipguide/fipguide.github.io/'
55+
gitHubUrl: 'https://github.com/fipguide/fipguide.github.io'

i18n/de.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ toc_name: Inhalt
2323
_operator__nearby: Angrenzende Betreiber
2424
toc-backlink: Zurück zu
2525
editPage: Seite bearbeiten
26+
reportError: Melde ein Fehler
2627
anchorLink:
2728
copy: Link zu diesem Abschnitt kopieren
2829
copied: Link wurde in die Zwischenablage kopiert

i18n/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ toc_name: Contents
2323
_operator__nearby: Neighboring Operators
2424
toc-backlink: Back to
2525
editPage: Edit page
26+
reportError: Report an error
2627
anchorLink:
2728
copy: Copy link to this section
2829
copied: Link has been copied to the clipboard
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- $url := .Destination -}}
22
{{- if strings.HasPrefix $url "http" -}}
3-
<a href="{{ $url }}" target="_blank" rel="noopener noreferrer"><span>{{ .Text }}</span>{{ partial "icon" "arrow_outward" }}</a>
3+
{{ partial "link" . }}
44
{{- else -}}
55
<a href="{{ $url }}">{{ .Text }}</a>
66
{{- end -}}

layouts/partials/icon.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
<span class="material-symbols-rounded" aria-hidden="true">{{ . }}</span>
2+
{{- /* Needed, otherwise links break: https://github.com/fipguide/fipguide.github.io/issues/116 */ -}}

layouts/partials/link.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<a href="{{ .Destination }}" target="_blank" rel="noopener noreferrer">{{ .Text }}{{- partial "icon" "arrow_outward" -}}</a>
2+
{{- /* Needed, otherwise links break: https://github.com/fipguide/fipguide.github.io/issues/116 */ -}}

layouts/partials/sidemenu.html

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@ <h3 id="related">{{ T "_operator__nearby"}}</h3>
6060
</ul>
6161
{{ end }}
6262
<hr>
63-
<a href="{{ .Site.Params.githubDevUrl }}blob/main/content{{ .Path }}/index.{{ .Language }}.md" target="_blank" rel="noopener noreferrer">
64-
{{ partial "icon" "edit_square" }}
65-
{{ T "editPage"}}
66-
</a>
63+
{{ partial "link"
64+
(dict
65+
"Destination" (print .Site.Params.githubDevUrl "blob/main/content" .Path "/index." .Language ".md")
66+
"Text" ((print (partial "icon" "edit_square" ) (T "editPage")) | .Page.RenderString)
67+
)
68+
}}
69+
{{ if eq .Page.Type "operator" }}
70+
{{ $operator := replace .Path (printf "/%s/" .Page.Type) "" }}
71+
{{ partial "link"
72+
(dict
73+
"Destination" (print .Site.Params.gitHubUrl "/issues/new?title=Issue+with+operator+" .LinkTitle "&labels=content,operator::" $operator)
74+
"Text" ((print (partial "icon" "bug_report" ) (T "reportError")) | .Page.RenderString)
75+
)
76+
}}
77+
{{ end }}
78+
{{ if eq .Page.Type "country" }}
79+
{{ $country := replace .Path (printf "/%s/" .Page.Type) "" }}
80+
{{ partial "link"
81+
(dict
82+
"Destination" (print .Site.Params.gitHubUrl "/issues/new?title=Issue+with+country+" .LinkTitle "&labels=content,country::" $country)
83+
"Text" ((print (partial "icon" "bug_report" ) (T "reportError")) | .Page.RenderString)
84+
)
85+
}}
86+
{{ end }}
6787
</div>
6888
</aside>

0 commit comments

Comments
 (0)