hexo-theme-stellar/layout/_partial/widgets/components/edit.ejs

25 lines
476 B
Plaintext
Raw Permalink Normal View History

2024-02-05 18:01:50 +08:00
<%
function parseURL() {
const source = page.source || ''
var url
for (let id of Object.keys(map)) {
2024-02-05 18:39:09 +08:00
if (source.startsWith(id) && map[id]) {
2024-02-05 18:01:50 +08:00
return source.replace(id, map[id])
}
}
}
function layoutDiv() {
const url = parseURL()
if (url == null) {
return ''
}
var el = ''
el += `<a class="edit" href="${url_for(url)}">`
el += icon('default:edit')
el += `<span>${__('btn.edit')}</span>`
el += `</a>`
return el
}
%>
<%- layoutDiv() %>