diff --git a/_config.yml b/_config.yml index 95a0ef939778..8db73088af17 100644 --- a/_config.yml +++ b/_config.yml @@ -234,6 +234,7 @@ scholar: query: "@*" +filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website] # Filter out certain bibtex entry keywords used internally from the bib output # ----------------------------------------------------------------------------- # Responsive WebP Images diff --git a/_layouts/bib.html b/_layouts/bib.html index a1a69b95efa1..1cefdc5b004e 100644 --- a/_layouts/bib.html +++ b/_layouts/bib.html @@ -170,7 +170,7 @@ {% if entry.bibtex_show -%} {%- endif %} diff --git a/_plugins/hideCustomBibtex.rb b/_plugins/hideCustomBibtex.rb new file mode 100644 index 000000000000..4a852fde6a6e --- /dev/null +++ b/_plugins/hideCustomBibtex.rb @@ -0,0 +1,15 @@ + module Jekyll + module HideCustomBibtex + def hideCustomBibtex(input) + keywords = @context.registers[:site].config['filtered_bibtex_keywords'] + + keywords.each do |keyword| + input = input.gsub(/^.*#{keyword}.*$\n/, '') + end + + return input + end + end +end + +Liquid::Template.register_filter(Jekyll::HideCustomBibtex)