dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: what is the correct way of handeling title,description and keywods?

  1. #1
    Join Date
    Jul 2013
    Posts
    118

    what is the correct way of handeling title,description and keywods?

    what is the correct and most effective way of handeling title,description and keywods on a website with alot of content(over 200 articles and counting)?

    I was thinking about saving the articles title,descritpion and keywords in the DB and then making a function that will echo it to meta, but I dont know if thats a good way of handeling it?

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    5,433
    You would only use keywords for that page that contains that article or information.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,214
    Your solution sounds reasonable: part of the article data can be what you want to include in each of those entities. You may want a default value if not present for some reason. The details of implementation will depend on how your application is designed: if you have a single PHP file that you use to display the head section of the page (and then, for instance, require() into the article view), then you could have a function or in-line code to do those things.
    PHP Code:
    <head>
    <title>My Site: <?php
    if(!empty($page_title)) {
      echo 
    $page_title;
    }
    else {
      echo 
    "A Default Title";
    }
    ?></title>
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    5,433
    or you could use HEREDOC type method of generating HTML and easily slot in prefabricated variables...
    PHP Code:
    $page_title = (isset( $page_title ) and !empty( $page_title )) ? $page_title "A Default Title";
    echo <<<HEREDOC
    <head>
    <title>My Site: 
    $page_title</title>

    HEREDOC; 
    This method is good for when you are outputting a large amount of HTML and your " usage would send you cross eyed.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  5. #5
    Join Date
    Jul 2013
    Posts
    118
    Thank you guys

  6. #6
    Join Date
    Jul 2017
    Location
    C-11,OKHLA VIHAR, JAMIA NAGAR, NEW DELHI-110025
    Posts
    23
    This is the text you'll see at the top of your browser. ... Google has also stated that keywords in meta descriptions won't affect your rankings. ... We've talked about the ways in which meta tags can have a very real impact on search

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center