/
alt3rmann
/
label-studio
Обзор
Документация
Войти
/
alt3rmann
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
docs/scripts/breadcrumb.js
29 строк
975 B
carly-bartel
docs: Style and content updates (#5407)
08 май 2024, 21:43
Не верифицирован
08 май 2024, 21:43
46c944f
Код
Авторство
О чём код?
var pathFn = require('path'); var fs = require('hexo-fs'); var fm = require('front-matter') module.exports = function(ctx) { return function includeTag({pageType, parentPage, currentPage, parentPageExtension = "md"}) { const parentFile = `${pageType}/${parentPage}.${parentPageExtension}`; var path = pathFn.join(ctx.source_dir, parentFile); // exit if path is not defined if (!path) { console.warn("Include file path undefined."); return; } const data = fs.readFileSync(path); const frontmatter = fm(data) return ` <nav class="breadcrumb" aria-label="Breadcrumb"> <a href="/${pageType}/${parentPage}.html">${frontmatter.attributes.short || frontmatter.attributes.title}</a> <svg width="6" height="9" viewBox="0 0 6 9" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1 8.5L5 4.5L1 0.5" stroke="#646676"/> </svg> <span>${currentPage}</span> </nav> ` }; };