However, this is bad - just try and export the raw data out and import it in using any SQL tool - it really doesnt like it . Is there a better way to do this? I guess the alternative is to use a macro to ouput the meta data? but not sure how that would look.
I think you have issues with the metaDescription field in HTML, that it doesn't output the content? I've written a blogpost about that a while back. Also check the comment from Petr which works also very well.
I used Visual Studio to perform a data compare , this scripted out the data from the umbraco db . However, this script will not run on any other sql server database due to the mixed single quote/double-quote text - caused by the umbraco macro being within the meta tag. If you use an umbraco macro on a template outside of the meta tags it uses double quotes for the properties. I guess ideally, I'd like to do this:
I usually use a macro for the meta data, that way I can also build in some "intelligence" if the user forgets to write something in the meta description field.
Here's an example of my macro, that checks if the user has entered a description text. If not, it just takes the first 160 characters of the bodyText.
another option is to use the insertTextBefore and insertTextAfter properties to build the surround meta tags. i use this all the time, it's simpler and quicker than creating a macro, but obviously less powerful.
Whats the correct way to reference a field value in meta data
I am using this..
<meta name="description" content="<umbraco:Item field='metaDescription' recursive='true' runat='server'></umbraco:Item>" />
However, this is bad - just try and export the raw data out and import it in using any SQL tool - it really doesnt like it . Is there a better way to do this? I guess the alternative is to use a macro to ouput the meta data? but not sure how that would look.
I'm not exactly sure what you're after here?
If you put this in your template, doesn't the meta-data display correctly in the source of your webpage?
I don't see the link with any SQL-tool here really, can you explain what you mean with that or what you are trying to achieve?
Hi Barry,
I think you have issues with the metaDescription field in HTML, that it doesn't output the content? I've written a blogpost about that a while back. Also check the comment from Petr which works also very well.
Cheers,
Richard
Sorry, I will explain..
I used Visual Studio to perform a data compare , this scripted out the data from the umbraco db . However, this script will not run on any other sql server database due to the mixed single quote/double-quote text - caused by the umbraco macro being within the meta tag. If you use an umbraco macro on a template outside of the meta tags it uses double quotes for the properties. I guess ideally, I'd like to do this:
<meta name="description" content="<umbraco:Item field="metaDescription" recursive="true" runat="server"></umbraco:Item>" />
Or
<meta name="description" content="[#metaDescription]" />
(# replace with umbraco field).
The safe alternative at the moment is to use a macro to set the whole metadata , the macro outputs the tags. I guess this is the best way?
I usually use a macro for the meta data, that way I can also build in some "intelligence" if the user forgets to write something in the meta description field.
Here's an example of my macro, that checks if the user has entered a description text. If not, it just takes the first 160 characters of the bodyText.
Barry,
another option is to use the insertTextBefore and insertTextAfter properties to build the surround meta tags. i use this all the time, it's simpler and quicker than creating a macro, but obviously less powerful.
is working on a reply...