There's a linebreak being inserted before and after the XSLT field data insertions, but as a group, not individually. I'd like the for the rendered tag (in source code) to be:
If I understand correctly now, I probably used the acronym XSLT incorrectly. The above code is all there is, no XSLT/Macros being called, at least that I'm aware of.
You don't have any xslt, just a template with umbraco:item tags.
Now to your question... you can remove the <asp:placeholder> tags... you are 99.99% unlikely to ever want to reference that section programatically in .NET. Google or Bing the asp:placeholder tag for more details if you're interested. It is a .net-ism and not specific to umbraco. It is there for Runway to allow a bit of fancy stuff when installing Runway modules but isn't needed beyond that. So there's no need for it.
In order to get tight output you just need to keep everything on one line in the template. Umbraco is a gentleman and does what you ask it :)
I suppose you could shove the output through a compressor to remove all the extra linebreaks automatically instead, but since the output from Umbraco is gzipped you're not really going to gain anything significant from a performance or download size standpoint.
Personally, I wouldn't worry about a few carriage returns that make the template easier to read. But if you are, now you know how to get the output you want. Just be sure you're truly looking at the code sent to the browser and not using firebug or a browser's "inspect" mode that will reformat the source when displaying it to you.
Doug; much thanks for so much detail. Yes it's pedantic, but so am I. ;)
Anyhow, that whole "title" was in the template without line breaks. Another post at the forum here, however, had my rethinking this. I'm now doing this:
You can certainly use the insertTextBefore="" and insertTextAfter="" parameters for the umbraco:Item tag and I'm glad it is working for you to get the output you want, though it is far less obvious when you go back to edit the markup later in the template.
But I've just now run some tests on Umbraco 4.5.2 and have no problem whatever with line breaks unless I put a linebreak in the template itself. This is how it has always been with Umbraco... what you type is what you get. But perhaps there's a bug in the version you're using that I've not noticed? What version of Umbraco are you using?
And just to be sure... what browser are you using to view the source? Can you check it in another browser using the 'view source' menu?
cheers, doug. (another pedantic soul who wants to know why you don't get the same behavior the rest of us get)
That's right, Doug, given the layers of IIS/Server Cache/DB/.NET/Umbraco and whatever else, the better I understand the 20% I can wrap my swiss-cheese brain around, the better I can use umbraco.
Important details:
Umbraco 4.5.2, the version 2 .NET version,
using WebMatrix's .NET 2 Integrated mode. (Since the site is young, I probably should switch to the .NET 4 version)
Chrome, using "View Source" (Inspector/FF's Firebug don't report on the source as I expect they would.) I do get the same render in IE8
Here's a snippet of code, with both "versions" running on the same master:
I'm running the same environment except that I am using .NET 4. I don't think you can make umbraco 4.5 run on anything less than .NET 3.5 and 4 (integrated mode) is probably preferred for easier upgrades in future that may require .net 4.
So, step 1 - change your site to run .net 4 integrated mode. It'll keep running :) Though, if you truly are running under .net 2 you'll need to make some changes to your web.config file. I'd recommend you save a copy of your existing web.config, copy over the .net 4 web.config from the umbraco downloaded zip file and then change any settings (like umbraco version number) between them.
With Firefox you just use 'view source' by right-clicking the page; no need for firebug or an inspector at all. Or, just hit ctrl-u to view the source.
Using your code and pasting it into my 4.5.2 site running on webmatrix with .net 4 integrated mode, and viewing source from chrome... I get:
<title>Go further - Runway</title> <title>Go further - Runway</title>
No line breaks either way, which is what I expected.
I so hate it when this forum "eats" my posts… Submit and > poof <
After typing a fair amount of detail, lost to the ether, I'll be brief: I've updated my install from 3.5 to 4. This included a wipe-n-copy of the App_Data and bin folders, from the 4.0 NET distro or else I got errors on unavailable files. My copy of WebMatrix errors if I set the mode to 4.0 Integrated with the 3.5 .NET version of Umbraco, 4.5.2
However, the output is the same, yes viewing page source, not firebug/inspector. I wonder why the difference?
You can run either .net 3.5 or .net 4 with umbraco 4.5.2. If you're using 3.5 that's cool. I simply understood from your earlier post that you were somehow running .net 2.
I do wonder why you're getting different results. I wonder if there is something special about the .net 3.5 build (I use .net 4 exclusively) or if there is some setting in the web.config or the master template that is causing the behavior. As I said, I have never seen what you've described in almost 5 years of umbraco use.
Thanks Doug, having the attention of the professor is always humbling. ;)
I had upgraded my umbraco core to the 4.0 version, as all my .NET friends insist that .NET 4.0 is the cats meow (and that 3.5 was really 2.0 just extended in ways that made the version numbering confusing to outsiders.)
Anyhow I am continuing with my template development, extra line breaks an all.
Extra line breaks being inserted, how to remove them?
I'd like to "tighten up" my rendered HTML. Consider the following head meta tag:
<asp:placeholder runat="server"><umbraco:Item runat="server" field="pageName" /> - <umbraco:Item runat="server" field="siteName" recursive="true" /></asp:placeholder>
Which renders as, in source:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /><title>
Products - Widgets 'R' Us!
</title><link rel="stylesheet" type="text/css" href="/css/styles.css" />
There's a linebreak being inserted before and after the XSLT field data insertions, but as a group, not individually. I'd like the for the rendered tag (in source code) to be:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /><title>Products - Widgets 'R' Us!</title><link rel="stylesheet" type="text/css" href="/css/styles.css" />
How do I get it rendered as a single unbroken line?
One last bonus question: the asp:placeholder tag is included from it's Runway parentage. What does it provide?
Thanks!
Hi Kyle
How does the XSLT you're using for this look like? To me it seems like you're just using an umbraco:item to get the content, right?
/Jan
Jan,
If I understand correctly now, I probably used the acronym XSLT incorrectly. The above code is all there is, no XSLT/Macros being called, at least that I'm aware of.
Much thanks!
Hi, Kyle,
You don't have any xslt, just a template with umbraco:item tags.
Now to your question... you can remove the <asp:placeholder> tags... you are 99.99% unlikely to ever want to reference that section programatically in .NET. Google or Bing the asp:placeholder tag for more details if you're interested. It is a .net-ism and not specific to umbraco. It is there for Runway to allow a bit of fancy stuff when installing Runway modules but isn't needed beyond that. So there's no need for it.
In order to get tight output you just need to keep everything on one line in the template. Umbraco is a gentleman and does what you ask it :)
I suppose you could shove the output through a compressor to remove all the extra linebreaks automatically instead, but since the output from Umbraco is gzipped you're not really going to gain anything significant from a performance or download size standpoint.
Personally, I wouldn't worry about a few carriage returns that make the template easier to read. But if you are, now you know how to get the output you want. Just be sure you're truly looking at the code sent to the browser and not using firebug or a browser's "inspect" mode that will reformat the source when displaying it to you.
cheers,
doug.
Doug; much thanks for so much detail. Yes it's pedantic, but so am I. ;)
Anyhow, that whole "title" was in the template without line breaks. Another post at the forum here, however, had my rethinking this. I'm now doing this:
<umbraco:Item field="pageName" insertTextBefore="<title>" runat="server"></umbraco:Item> - <umbraco:Item field="siteName" insertTextAfter="</title>" recursive="true" runat="server"></umbraco:Item>
Which outputs to a single line. I got the idea from a different thread here.
You can certainly use the insertTextBefore="" and insertTextAfter="" parameters for the umbraco:Item tag and I'm glad it is working for you to get the output you want, though it is far less obvious when you go back to edit the markup later in the template.
But I've just now run some tests on Umbraco 4.5.2 and have no problem whatever with line breaks unless I put a linebreak in the template itself. This is how it has always been with Umbraco... what you type is what you get. But perhaps there's a bug in the version you're using that I've not noticed? What version of Umbraco are you using?
And just to be sure... what browser are you using to view the source? Can you check it in another browser using the 'view source' menu?
cheers,
doug. (another pedantic soul who wants to know why you don't get the same behavior the rest of us get)
That's right, Doug, given the layers of IIS/Server Cache/DB/.NET/Umbraco and whatever else, the better I understand the 20% I can wrap my swiss-cheese brain around, the better I can use umbraco.
Important details:
Here's a snippet of code, with both "versions" running on the same master:
<umbraco:Item field="pageName" insertTextBefore="<title>" runat="server"></umbraco:Item> - <umbraco:Item field="siteName" insertTextAfter="</title>" recursive="true" runat="server"></umbraco:Item> <title><umbraco:Item field="pageName" runat="server"></umbraco:Item> - <umbraco:Item field="siteName" recursive="true" runat="server"></umbraco:Item></title>
Which renders, via "View Source"
I'm guessing a text filter/processer will keep the above intact.
Thanks! Happy New Year, all!
I'm running the same environment except that I am using .NET 4. I don't think you can make umbraco 4.5 run on anything less than .NET 3.5 and 4 (integrated mode) is probably preferred for easier upgrades in future that may require .net 4.
So, step 1 - change your site to run .net 4 integrated mode. It'll keep running :) Though, if you truly are running under .net 2 you'll need to make some changes to your web.config file. I'd recommend you save a copy of your existing web.config, copy over the .net 4 web.config from the umbraco downloaded zip file and then change any settings (like umbraco version number) between them.
With Firefox you just use 'view source' by right-clicking the page; no need for firebug or an inspector at all. Or, just hit ctrl-u to view the source.
Using your code and pasting it into my 4.5.2 site running on webmatrix with .net 4 integrated mode, and viewing source from chrome... I get:
<title>Go further - Runway</title> <title>Go further - Runway</title>
No line breaks either way, which is what I expected.
cheers,
doug.
I so hate it when this forum "eats" my posts… Submit and > poof <
After typing a fair amount of detail, lost to the ether, I'll be brief: I've updated my install from 3.5 to 4. This included a wipe-n-copy of the App_Data and bin folders, from the 4.0 NET distro or else I got errors on unavailable files. My copy of WebMatrix errors if I set the mode to 4.0 Integrated with the 3.5 .NET version of Umbraco, 4.5.2
However, the output is the same, yes viewing page source, not firebug/inspector. I wonder why the difference?
You can run either .net 3.5 or .net 4 with umbraco 4.5.2. If you're using 3.5 that's cool. I simply understood from your earlier post that you were somehow running .net 2.
I do wonder why you're getting different results. I wonder if there is something special about the .net 3.5 build (I use .net 4 exclusively) or if there is some setting in the web.config or the master template that is causing the behavior. As I said, I have never seen what you've described in almost 5 years of umbraco use.
cheers,
doug.
Thanks Doug, having the attention of the professor is always humbling. ;)
I had upgraded my umbraco core to the 4.0 version, as all my .NET friends insist that .NET 4.0 is the cats meow (and that 3.5 was really 2.0 just extended in ways that made the version numbering confusing to outsiders.)
Anyhow I am continuing with my template development, extra line breaks an all.
Happy New Year,
Kyle
is working on a reply...