eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

Template engine parses unexpected strings

Open xplosionmind opened this issue 3 years ago • 6 comments

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">
  1. 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.
  2. 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:

  • OS and Version: MacOS 12.4
  • Eleventy Version 1.0.1

xplosionmind avatar Jun 01 '22 17:06 xplosionmind

Lookin’

zachleat avatar Jun 16 '22 19:06 zachleat

ohhhhh dang the directory output plugin—a rare sighting!

zachleat avatar Jun 16 '22 19:06 zachleat

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?

zachleat avatar Jun 16 '22 20:06 zachleat

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 avatar Jun 18 '22 06:06 xplosionmind

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)

xplosionmind avatar Sep 18 '22 08:09 xplosionmind

@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).

pdehaan avatar Sep 18 '22 15:09 pdehaan