jekyll-theme-profile 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,160 +0,0 @@
1
- {%- assign user = site.github.owner %}
2
-
3
- {% capture last_char %}{{ page.url | slice: -1 }}{% endcapture %}
4
- {%- if last_char == '/' %}
5
- {%- capture page_url %}{{ page.url | append: "index.html" }}{% endcapture %}
6
- {%- else %}
7
- {%- assign page_url = page.url %}
8
- {%- endif %}
9
-
10
- {%- assign page_title = page.title | default: site.title | default: user.name | default: user.login %}
11
- {%- if page.path contains '_posts' %}
12
- {%- assign post_description = page.content | strip_html | strip_newlines | xml_escape | truncate: 300 %}
13
- {%- endif %}
14
- {%- assign user_bio = user.bio | strip_html | strip_newlines | xml_escape | truncate: 300 %}
15
- {%- assign meta_description = page.description | default: post_description | default: site_description | default: user_bio %}
16
- {%- assign social_image = page.social_image | default: site.social_image | default: user.avatar_url %}
17
- {%- assign bg_image = page.background_image | default: site.background.image | default: null %}
18
-
19
- <head>
20
- <meta charset="utf-8">
21
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
22
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
23
- <!-- HTML Meta Tags -->
24
- <title>{{ page_title }}</title>
25
- <meta name="description" content="{{ meta_description }}">
26
-
27
- <!-- Opengraph Meta Tags -->
28
- <meta property="og:url" content="{{ page_url | absolute_url }}">
29
- <meta property="og:type" content="website">
30
- <meta property="og:title" content="{{ page_title }}">
31
- <meta property="og:description" content="{{ meta_description }}">
32
- <meta property="og:image" content="{{ social_image | absolute_url }}">
33
-
34
- <!-- Twitter Meta Tags -->
35
- <meta name="twitter:card" content="summary_large_image">
36
- <meta property="twitter:domain"
37
- content="{{ site.url | replace: 'http://', '' | replace: 'https://', '' | replace: 'www.', '' }}">
38
- <meta property="twitter:url" content="{{ page_url | absolute_url }}">
39
- <meta name="twitter:title" content="{{ page_title }}">
40
- <meta name="twitter:description" content="{{ meta_description }}">
41
- <meta name="twitter:image" content="{{ social_image | absolute_url }}">
42
- {%- if site.social_media.twitter %}
43
- <meta name="twitter:site" content="@{{ site.social_media.twitter }}">
44
- {%- endif %}
45
-
46
- <link href="{{ '/assets/css/theme.css' | relative_url }}" rel="stylesheet" type="text/css">
47
- <link href="{{ '/assets/css/style.css' | relative_url }}" rel="stylesheet" type="text/css">
48
- <link rel="icon" type="image/x-icon" href="{{ '/assets/img/favicon.ico' | relative_url}}">
49
- <link rel="canonical" href="{{ page.url | absolute_url }}">
50
-
51
-
52
- {%- if site.analytics.provider == 'google' %}
53
- <!-- Google tag (gtag.js) -->
54
- <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.property }}"></script>
55
- <script>
56
- window.dataLayer = window.dataLayer || [];
57
- function gtag() { dataLayer.push(arguments); }
58
- gtag('js', new Date());
59
-
60
- gtag('config', '{{ site.analytics.property }}');
61
- </script>
62
- {%- endif %}
63
-
64
- <script>
65
- document.addEventListener('DOMContentLoaded', function () {
66
- var themeToggle = document.getElementById('theme-toggle');
67
- var themeIcon = document.getElementById('theme-icon');
68
- var htmlElement = document.getElementsByTagName('html')[0];
69
-
70
- function getCurrentMode() {
71
- return htmlElement.getAttribute('data-color-mode');
72
- }
73
-
74
- function getModeFromCookie() {
75
- var cookieValue = getCookie('colorMode');
76
- if (cookieValue !== null && (cookieValue === 'auto' || cookieValue === 'dark' || cookieValue === 'light')) {
77
- return cookieValue;
78
- } else {
79
- // Default to 'auto' mode if the cookie is not set or has an invalid value
80
- return 'auto';
81
- }
82
- }
83
-
84
- function setCookie(name, value, days) {
85
- var expires = "";
86
- if (days) {
87
- var date = new Date();
88
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
89
- expires = "; expires=" + date.toUTCString();
90
- }
91
- document.cookie = name + "=" + (value || "") + expires + "; path=/";
92
- }
93
-
94
- function getCookie(name) {
95
- var nameEQ = name + "=";
96
- var ca = document.cookie.split(';');
97
- for (var i = 0; i < ca.length; i++) {
98
- var c = ca[i];
99
- while (c.charAt(0) === ' ') c = c.substring(1, c.length);
100
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
101
- }
102
- return null;
103
- }
104
-
105
- function getNextMode() {
106
- var currentMode = getCurrentMode();
107
- var nextMode;
108
- if (currentMode === 'auto') {
109
- nextMode = 'dark';
110
- } else if (currentMode === 'dark') {
111
- nextMode = 'light'
112
- } else {
113
- nextMode = 'auto'
114
- }
115
- return nextMode;
116
- }
117
-
118
- function updateTheme(nextMode) {
119
- htmlElement.setAttribute('data-color-mode', nextMode);
120
- updateThemeIcon(nextMode);
121
- setCookie('colorMode', nextMode, 365); // Save the preference for 365 days
122
- }
123
-
124
- function updateThemeIcon(nextMode) {
125
- if (nextMode === 'dark') {
126
- nextIcon = 'moon';
127
- } else if (nextMode === 'light') {
128
- nextIcon = 'sun'
129
- } else {
130
- nextIcon = 'zap';
131
- }
132
- // Set the span to the themeIcon class
133
- themeIcon.classList = "octicon octicon-" + nextIcon + "-24";
134
- themeToggle.setAttribute("aria-label", "Color mode: " + nextMode);
135
- }
136
-
137
- themeToggle.addEventListener('click', function () {
138
- updateTheme(getNextMode());
139
- // updateThemeIcon(getNextMode());
140
- });
141
-
142
- // Initialize the theme icon based on the initial state
143
- // updateThemeIcon(getModeFromCookie());
144
- updateTheme(getModeFromCookie());
145
- });
146
- </script>
147
-
148
- {%- if bg_image %}
149
- <style>
150
- body {
151
- position: relative;
152
- background-image: url('{{ bg_image | relative_url }}');
153
- background-size: cover;
154
- background-repeat: no-repeat;
155
- background-attachment: fixed;
156
- z-index: -10;
157
- }
158
- </style>
159
- {%- endif %}
160
- </head>