File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,19 @@ module DescriptionGenerator
104104 def describe ( input , max_length = 160 )
105105 return "" if input . nil? || input . to_s . strip . empty?
106106
107+ # Render Liquid tags first if $site is defined
108+ markdown = input . to_s
109+ if defined? ( $site) && $site
110+ begin
111+ markdown = $site. liquid_renderer . file ( "(cs50-describe)" ) . parse ( markdown ) . render! ( $site. site_payload , { :registers => { :site => $site } } )
112+ rescue => e
113+ Jekyll . logger . warn "CS50 warning: failed to render Liquid in description: #{ e . message } "
114+ markdown = input . to_s
115+ end
116+ end
117+
107118 # Convert Markdown to HTML
108- html = $site. find_converter_instance ( ::Jekyll ::Converters ::Markdown ) . convert ( input . to_s )
119+ html = $site. find_converter_instance ( ::Jekyll ::Converters ::Markdown ) . convert ( markdown )
109120
110121 # Parse HTML and extract text
111122 doc = Nokogiri ::HTML5 . fragment ( html )
You can’t perform that action at this time.
0 commit comments