forked from TryGhost/Source
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.hbs
108 lines (87 loc) · 3.62 KB
/
default.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="{{@site.locale}}" class="has-light-text">
<head>
{{!-- Basic meta - advanced meta is output with {{ghost_head}} below --}}
{{#is "home"}}
<title>{{@site.title}} - {{@site.description}}</title>
{{else}}
<title>{{meta_title}} - {{@site.title}}</title>
{{/is}}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{!-- Preload main styles and scripts for better performance --}}
<link rel="preload" as="style" href="{{asset "built/screen.css"}}">
<link rel="preload" as="script" href="{{asset "built/source.js"}}">
<link rel="preload" as="style" href="{{asset "built/brands.css"}}">
{{#is "post"}}
<link rel="preload" as="style" href="{{asset "built/tocbot.css"}}">
{{/is}}
{{!-- Fonts are preloaded and defined in the default template to avoid layout shift --}}
{{> "typography/fonts"}}
{{!-- Theme assets - use the {{asset}} helper to reference styles & scripts, this will take care of caching and cache-busting automatically --}}
<link rel="stylesheet" type="text/css" href="{{asset "built/screen.css"}}">
<link rel="stylesheet" type="text/css" href="{{asset "built/brands.css"}}">
{{!-- Custom background color --}}
<style>
:root {
--background-color: {{@custom.site_background_color}}
}
</style>
{{#is "home, page, author"}}
{{!-- Home dont need change locales --}}
{{else}}
<script>
/* Set the language attribute on the HTML element based on the subpath of the URL
This script will set the language attribute on the HTML element based on the subpath of the URL
*/
document.addEventListener('DOMContentLoaded', function () {
var path = window.location.pathname.split('/')[1]; // Get the first subpath
var lang = '{{@site.locale}}'; // Default language
// Map subpaths to locales
var localeMap = {
'es': 'es',
'br': 'pt',
'en': 'en',
// Add more mappings as needed
};
if (localeMap.hasOwnProperty(path)) {
lang = localeMap[path];
}
document.querySelector('html').setAttribute('lang', lang);
});
</script>
{{/is}}
{{!-- Ghost outputs important meta data with this tag --}}
{{ghost_head}}
</head>
<body class="{{body_class}}">
<div class="gh-viewport">
{{> "components/navigation" [email protected]_layout}}
{{{body}}}
{{> "components/footer"}}
</div>
{{#is "post, page"}}
{{> "lightbox"}}
{{/is}}
{{#is "post"}}
<link rel="stylesheet" type="text/css" href="{{asset "built/tocbot.css"}}">
<script src="{{asset "js/lib/tocbot.js" type="text/javascript"}}"></script>
<script>
tocbot.init({
// Where to render the table of contents.
tocSelector: '.gh-toc',
// Where to grab the headings to build the table of contents.
contentSelector: '.gh-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: 'h1, h2, h3, h4, h5, h6',
// Ensure correct positioning
hasInnerContainers: true,
});
</script>
{{/is}}
{{!-- Scripts - handle responsive videos, infinite scroll, and navigation dropdowns --}}
<script src="{{asset "built/source.js"}}"></script>
{{!-- Ghost outputs required functional scripts with this tag, it should always be the last thing before the closing body tag --}}
{{ghost_foot}}
</body>
</html>