如何将.xml文件转换成.toml
-
1 min read
引子
由于hugo官方默认的config文件为.toml格式,而我此处使用的皮肤官方页面全部采用.xml编写,根据作者来看他认为这样更简明。。。链接如下:Features · adityatelange/hugo-paper
短时间内并没有找到自动转换工具,但是找到一个简单的格式模板,在此记录
内容
原先的.xml配置内容:
related:
threshold:80
includeNewer:false
toLower:false
indices:
-name:keywords
weight:100
-name:date
weight:10
转换之后的.toml配置内容:
[related]
threshold = 80.0
includeNewer = false
toLower = false
[[related.indices]]
name = "ketwords"
weight = 100.0
[[related.indices]]
name = "date"
weight = 10.0
更多的的:
params:
profileMode:
enabled: true
title: "<Title>" # optional default will be site title
subtitle: "This is subtitle"
imageUrl: "<image link>" # optional
imageTitle: "<title of image as alt>" # optional
imageWidth: 120 # custom size
imageHeight: 120 # custom size
buttons:
- name: Archive
url: "/archive"
- name: Github
url: "https://github.com/"
socialIcons: # optional
- name: "<platform>"
url: "<link>"
- name: "<platform 2>"
url: "<link2>"
应变更为:
[params]
[params.profileMode]
enabled = "true"
title = "<title>" # optional default will be site title
subtitle = "This is subtitle"
imageUrl = "<image link>" # optional
imageTitle = "<title of image as alt>" # optional
imageWidth = 120 # custom size
imageHeight = 120 # custom size
[[params.profileMode.buttons]]
name = "Archive"
url = "/Archive"
[[params.profileMode.buttons]]
name = "Github"
url = "https://github.com"
[[params.socialIcons]]
name = "<platform>"
url = "<link>"
[[params.socialIcons]]
name = "<platform 2>"
url = "<link2>"