asp.net MVC3 auto generate meta keywords and description based on page content -
i'm working on mvc3 web application using razor view engine. i'm looking solution generate meta keywords , description automatically on pages.
i've found this solution here on stackoverflow, idea looking good. since i'm planning post blogs etc... on website want meta keywords , description auto generated based on content of page.
soo far i've got following things in mind. let's current html looks below;
<html> <head> </head> <body> <header></header> <div id="container"> <div id="sidebar"></div> <div id="pageheader"></div> <div id="content"> <!--this part contains dynamic content--> </div> <div class="clear"></div> </div> <footer></footer> </body> </html> the desired situation me below;
<html> <head> @html.metakeywords() @html.metadescription() </head> <body> <header></header> <div id="container"> <div id="sidebar"></div> <div id="pageheader"></div> <div id="content"> <!--this part contains dynamic content--> </div> <div class="clear"></div> </div> <footer></footer> </body> </html> said i've got following questions left unanswered, hope can help.
- the situation described above, html-helpers. , logic approach generate keywords , description on every single page, based on content?
- if is, has experience , maybe example?
- if not, there other options? other using attribute on each controller action? still option, doesn't generate keywords description based on page content.
i hope can me out. thanks!
if i'm understanding correctly, want able auto generate metadata based on text inside content div?
i try passing text / html / model metakeywords , metadescription functions, , allowing them parse / analyze / look-up information need put in metadata.
<html> <head> @html.metakeywords(model.contenttext) @html.metadescription(model.contenttext) </head> <body> <header></header> <div id="container"> <div id="sidebar"></div> <div id="pageheader"></div> <div id="content"> <!--this part contains dynamic content--> </div> <div class="clear"></div> </div> <footer></footer> </body> </html>
Comments
Post a Comment