You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2019-08-08-write-a-new-post.md
+29-16Lines changed: 29 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ author: Cotes Chung
4
4
date: 2019-08-08 14:10:00 +0800
5
5
categories: [Blogging, Tutorial]
6
6
tags: [writing]
7
+
render_with_liquid: false
7
8
---
8
9
9
10
## Naming and Path
@@ -163,7 +164,7 @@ If you host the images on the CDN, you can save the time of repeatedly writing t
163
164
```yaml
164
165
img_cdn: https://cdn.com
165
166
```
166
-
{: .nolineno}
167
+
{: file='_config.yml' .nolineno}
167
168
168
169
Once `img_cdn` is assigned, the CDN url will be added to the path of all images (images of site avatar and posts) starting with `/`.
169
170
@@ -193,30 +194,27 @@ pin: true
193
194
194
195
## Code Block
195
196
196
-
Markdown symbols ```` ``` ```` can easily create a code block as following examples.
197
+
Markdown symbols ```` ``` ```` can easily create a code block as follows:
197
198
198
199
```
199
-
This is a common code snippet, without syntax highlight and line number.
200
+
This is a plaintext code snippet.
200
201
```
201
202
202
-
### Specific Language
203
-
204
-
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight.
203
+
### Specifying Language
205
204
206
-
> **Note**: The Jekyll style `{% raw %}{%{% endraw %} highlight LANGUAGE {% raw %}%}{% endraw %}` or `{% raw %}{%{% endraw %} highlight LANGUAGE linenos {% raw %}%}{% endraw %}` are not allowed to be used in this theme !
205
+
Using ```` ```{language} ```` you will get a code block with syntax highlight:
207
206
207
+
````markdown
208
208
```yaml
209
-
# Yaml code snippet
210
-
items:
211
-
- part_no: A4786
212
-
descrip: Water Bucket (Filled)
213
-
price: 1.47
214
-
quantity: 4
209
+
key: value
215
210
```
211
+
````
216
212
217
-
### Hiding Line Number
213
+
> **Limination**: The Jekyll style `highlight` tag ais not compatible with this theme.
218
214
219
-
When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line of it:
215
+
### Line Number
216
+
217
+
By default, all languages except `plaintext`, `console` and `terminal` will display line numbers. When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line:
220
218
221
219
````markdown
222
220
```shell
@@ -225,17 +223,32 @@ echo 'No more line numbers!'
225
223
{: .nolineno}
226
224
````
227
225
226
+
### Specifying the Filename
227
+
228
+
You may have noticed that the code language will be displayed on the left side of the header of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
229
+
230
+
````markdown
231
+
```shell
232
+
# content
233
+
```
234
+
{: file="path/to/file" }
235
+
````
236
+
228
237
### Liquid Codes
229
238
230
-
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` .
239
+
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
231
240
241
+
````markdown
232
242
{% raw %}
233
243
```liquid
234
244
{% if product.title contains 'Pack' %}
235
245
This product's title contains the word Pack.
236
246
{% endif %}
237
247
```
238
248
{% endraw %}
249
+
````
250
+
251
+
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
Copy file name to clipboardExpand all lines: _posts/2021-01-03-enable-google-pv.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,7 @@ google_analytics:
45
45
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
46
46
cache_path: # the local PV cache data, friendly to visitors from GFW region
47
47
```
48
+
{: file="_config.yml"}
48
49
49
50
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
50
51
@@ -140,6 +141,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
140
141
# XSRF Settings
141
142
XSRF_KEY = 'OnceUponATimeThereLivedALegend'
142
143
```
144
+
{: file="src/config.py"}
143
145
144
146
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
145
147
@@ -226,6 +228,7 @@ google_analytics:
226
228
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
227
229
cache_path: # the local PV cache data, friendly to visitors from GFW region
228
230
```
231
+
{: file="_config.yml"}
229
232
230
233
Now, you should see the Page View enabled on your blog.
0 commit comments