11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.84k stars 487 forks source link

Template engine parses unexpected strings #2420

Open xplosionmind opened 2 years ago

xplosionmind commented 2 years ago

Describe the bug The template engine prints some unexpected strings

To Reproduce Steps to reproduce the behavior:

  1. clone quitsocialmedia.club
  2. In layouts/wrapper.html look at this function
  3. In includes/nav.html check this function using the results of the previous one
  4. run npm run start
  5. Unexpectedly, in every page containing the rendered nav.html, a bunch of <a> tags are added. For example, the output of pages/Home.html is:

    <li class="dropdown">
                    <label for="langtoggle" title="language selector">🌍</label>
                    <input aria-hidden="true" type="checkbox" id="langtoggle">
                    <ul class="lang-list">
    
                            <li><a rel="alternate" href="[/accueil/](view-source:http://localhost:8080/accueil/)" title="Accueil" hreflang="fr">🇫🇷</a></li><a rel="alternate" href="[/accueil/](view-source:http://localhost:8080/accueil/)" title="Accueil" hreflang="fr">
    
                            </a><li><a rel="alternate" href="[/accueil/](view-source:http://localhost:8080/accueil/)" title="Accueil" hreflang="fr"></a><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">🇮🇹</a></li><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    
                    </a></ul><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
                </a></li><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    
        </a></ul><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    </a></nav><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    </a></header><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    
        </a><div class="one column"><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    <div class="row">
        <section class="page-header">
            <h1>Quit Social Media</h1>
            <p>All of the reasons why Social Media platforms are bad and possible solutions to live a happy life on the web without them</p>
        </section>
    </div>
    
    </a><div class="row"><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
    </a><section class="red box"><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
            <h2 class="title">WTF is this website?</h2>
            </a><p><a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">
  6. as you can see, there are many extra unexpected <a rel="alternate" href="[/it/home/](view-source:http://localhost:8080/it/home/)" title="Home" hreflang="it">, definitely out of place.
  7. Same goes for every other page, even in other languages (even if the string repeating is different)

Expected behavior The correct behavior happens in another place, following the same logic. For example, in includes/head.html this function prints out the correct result, without any trash (output always from pages/Home.html):

<meta property="og:locale:alternate" content="fr">
<link rel="alternate" hreflang="fr" href="[/accueil/](view-source:http://localhost:8080/accueil/)">

<meta property="og:locale:alternate" content="it">
<link rel="alternate" hreflang="it" href="[/it/home/](view-source:http://localhost:8080/it/home/)">

Environment:

zachleat commented 2 years ago

Lookin’

zachleat commented 2 years ago

ohhhhh dang the directory output plugin—a rare sighting!

zachleat commented 2 years ago

I think this might be a plugin issue, not sure! I can’t reproduce it locally:

image

yours: image

Can you go through your third-party plugins and comment them out one-by-one to see if one of them is causing the issue?

xplosionmind commented 2 years ago

The issue still shows up when all plugins are removed. Please do not refer to the published version, it still relies on a broken Jekyll build. Please refer to this branch for further testing.


ohhhhh dang the directory output plugin—a rare sighting!

I take it as a compliment, thanks a lot!

xplosionmind commented 1 year ago

Hello there, the problem still persists… I removed one-by-one each plugin: this is not a problem caused by a plugin.

What can I do?

(Note: I deployed the website to production, the content of the repo is deployed to quitsocialmedia.club)

pdehaan commented 1 year ago

@xplosionmind Which page(s) are showing unexpected strings in the output? I git cloned, npm installed, and then ran npm run watch:eleventy but didn't see anything obvious on the local dev server (or on your production site).