diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug
index 6638bff..c9cbdfa 100644
--- a/layout/includes/page/flink.pug
+++ b/layout/includes/page/flink.pug
@@ -1,73 +1,50 @@
#article-container
.flink
- - let pageContent = page.content
- if page.flink_url
- script.
- (()=>{
- const replaceSymbol = (str) => {
- return str.replace(/[\p{P}\p{S}]/gu, "-")
- }
+ script.
+ (()=>{
+ const replaceSymbol = (str) => {
+ return str.replace(/[\p{P}\p{S}]/gu, "-")
+ }
- let result = ""
- fetch("!{url_for(page.flink_url)}")
- .then(response => response.json())
- .then(str => {
- for(let i = 0; i < str.length; i++){
- const replaceClassName = replaceSymbol(str[i].class_name)
- const className = str[i].class_name ? `
${str[i].class_name}
` : ""
- const classDesc = str[i].class_desc ? `${str[i].class_desc}
` : ""
-
- let listResult = ""
- const lists = str[i].link_list
- if (!{page.random}) {
- lists.sort(() => Math.random() - 0.5)
- }
- for(let j = 0; j < lists.length; j++){
- listResult += `
- `
- }
+ let result = ""
+ function add(str) {
+ for(let i = 0; i < str.length; i++){
+ const replaceClassName = replaceSymbol(str[i].class_name)
+ const className = str[i].class_name ? `${str[i].class_name}
` : ""
+ const classDesc = str[i].class_desc ? `${str[i].class_desc}
` : ""
- result += `${className}${classDesc} ${listResult}
`
- }
-
- document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
- window.lazyLoadInstance && window.lazyLoadInstance.update()
- })
- })()
-
- else
- if site.data.link
- - let result = ""
- each i in site.data.link
- - let className = i.class_name ? markdown(`## ${i.class_name}`) : ""
- - let classDesc = i.class_desc ? `${i.class_desc}
` : ""
-
- - let listResult = ""
- - let list = page.random ? i.link_list.slice().sort(() => Math.random() - 0.5) : i.link_list
- each j in list
- -
+ let listResult = ""
+ const lists = str[i].link_list
+ if (!{page.random}) {
+ lists.sort(() => Math.random() - 0.5)
+ }
+ for(let j = 0; j < lists.length; j++){
listResult += `
`
- -
+ }
- - result += `${className}${classDesc} ${listResult}
`
+ result += `${className}${classDesc} ${listResult}
`
+ }
- - pageContent = result + pageContent
- != pageContent
+ document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
+ window.lazyLoadInstance && window.lazyLoadInstance.update()
+ }
+ const linkData = !{JSON.stringify(site.data.link)}
+ if ("!{page.flink_url}") {
+ fetch("!{url_for(page.flink_url)}")
+ .then(response => response.json())
+ .then(add)
+ } else if (linkData) {
+ add(linkData)
+ }
+ })()
+ != page.content