Replies: 2 comments
-
| Could you provide a Git repository with all this? This would make it easier to use thus to help you. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| yes. Nice remark. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Dear community.
I need to reuse a chunk of ejs code in several pages of a quarto website. It seems to be known as partial ejs files in the documentations. But I cannot be able to make it work despite some effort. Here is the setup:
I have a
test.ymlthat reads :A
test.ejslooping over the entries of the.ymland displaying the links... It reads```{=html} <% function renderLinks(links) { %> <% if (links && links.length > 0) { %> <% links.forEach(function(link) { %> <a href="<%- link.link %>"><%- link.name %></a> <% }); %> <% } %> <% } %> <div class="list"> <% for (const item of items) { %> <div class="list-content"> <b><%= item.name %>:</b> <% renderLinks(item.links); %> </div> <% } %> </div> ``` <%# nested ```, remove this comment %>And finally a
index.qmdwithRendering works like a charm.
But... question: If I want to split the .ejs in two files to reuse my function:
Let
function.ejsbeand
test.ejsbegot a
ReferenceError: renderLinks is not defined...Beta Was this translation helpful? Give feedback.
All reactions