Jump to content

Recommended Posts

Andrew,

That's obviously MODX syntax. Before I answer your question, I have two things to say:

1. Please, if you have a question, post in either the General Support  or the Getting Started or the API & Templates sections of these forums according the the relevance of the question.. This is the Tutorials Section of the Board where your posts/threads should be teaching something rather than asking questions, thanks. :)

2. Have you read this guide to PW for those familiar with MODX? If not, please do. It will answer questions such as above.

As you'll see from that guide, apart from the name of a page, all other fields on a page are custom fields. There is no default title, keywords, description, etc fields. You will have to create those fields and add them to your template. Then, create a page and make it use that template. If you want your keywords to be unique to each page, then do it this way (illustrated below). If you want your keywords to be the same across the whole site, then you can create a page that will act as a settings page. For now, I'am not going to go into details about such a setup but will let you explore the system more.

OK, so,

1. Create the following fields types

a. Name: keywords; Type: text or text area (depending on how much space you want)

b. Name: description; Type: text area

Make sure to give the fields labels and a "description" if you want to.

Your PW install should already come with the title field (if you installed the default PW profile)

2. Add the fields to your template. Order the fields in the template as you wish

3. Create a page and make it use the template in #2

4. You will see the keywords, description and title fields on that page. Enter your keywords and description in the fields and edit the page as you wish. Hit save.

5. In your template file

<meta name="keywords" content="<?php echo $page->keywords;?>"/>
<meta name="description" content="<?php echo $page->description;?>"/>
<meta name="robots" content="All"/>
<title><?php echo $page->title;?></title>

You don't need the <base> tag in ProcessWire.

You can get fancy and only echo out the keywords and description if they are actually present on your page. How to do that? That'll be your homework ;)

  • Like 3
Link to post
Share on other sites

Ваш ответ поздно увидел,Спасибо!!! сам во всем разобрался CMS ^-^

Your answer has late seen,Thank you!!! itself in all understood CMS 

<!DOCTYPE html>
<html lang="en">
<head>
       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
       <title><?php echo $page->get("headline|title"); ?></title>
       <meta name="description" content="<?php echo $page->summary; ?>" />
       <meta name="keywords" content="<?php echo $page->keywords; ?>" />
       <meta name="robots" content="all" />
       <link rel="icon" href="/favicon.ico" type="image/x-icon" />
       <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
       <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates ?>styles/style.css?v=3"/>
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I ran into a strange error this morning when trying to publish a page. I went to publish a new page under "clients", but I get an error that says "Cannot be published until errors are corrected". I thought perhaps I had missed a required field so I checked, but none of the fields are marked as required. I then checked to see if I could just add a basic page (default basic-page.php template) under the homepage, but I get the exact same error when trying to publish. When looking at the template, I don't see any error messages being displayed above any fields.
      The odd thing I found though was if I got to "settings"  and uncheck "unpublished", I can then publish the page without errors. I did upgrade earlier today to the newest version to hopefully fix an issue I had yesterday (which it did). Has anyone run into this error before? 
      **EDIT**
      Well, after a lot of staring and pulling my hair out, I found the issues. I had installed multi-language support sometime ago (and due to the project changing, had to remove it). Apparently in my haste, I did not remove all the dependencies so it was still trying to check for the multi-language title (I am guessing) even though it actually wasnt on the page. I went through the database and removed it and can now save/publish pages without issues. 
    • By NehaPillai
      Hello Everyone, I was trying to update SEO meta title, description and meta keywords for my website in Process Wire CMS but it saving in the backend but it is not reflecting on my website, Please help me regarding this error. Please find below attached screen shot for your ref. TIA.


    • By AndZyk
      Hello,
      when you add a page you can see the page name of the page under the page title field. But when you change the page title afterwards, you have to go to the settings tab to also change the page name.
      We have many clients that change the page title afterwards but forget to change the page name, because they don't look in the settings tab or forget it.
      Is it possible to show the page name on the content tab under the page title?
      I hate to say this, but I like how WordPress handles this better:

      Or should I open an GitHub request?
      Regards, Andreas
    • By j00st
      Hi all! 
      I've been searching/browsing a bit, but can't find what I'm looking for just yet...
      Perhaps I'm searching in the wrong places, but I thought posting it here might work better/more efficient.
      I need to do the following;
      1. I have the TITLE field (the one set by ProcessWire as default).
      2. There's already a whole lot of pages of the template 'project' set up.
      3. Now I actually want to be able to add <i> and <br> tags to this title...which is possible if I turn off the specialchar encoder...
      ...but it also presents the opportunity for people to start typing, and generate the following kind of URLs:

      TITLE: This is a really long title <br> which <i>needs</i> to be split in two
      URL generated: this-is-a-really-long-title-br-which-i-needs-i-to-be-split-in-tow
      Don't want that happening. So, I thought it might be wiser to do the following.
      Next to the 'title' field, also set a 'display-title' field.
      But, preferably I'd want to generate this for all the projects already in existance...including copying their content to this new display-title field.
      Just adding the field means all the titles will need to be copied...not something I look forward to telling the editors of the site 🙂
      I saw the Hook for on-save, but that's only for the single page...and I'm not an experienced MySQL-coder/user, otherwise I guess that would've been the way to go.
      So I'm really curious to hear if you guys think there are other/better options (and what they are)
      Thanks!
    • By Roberts R
      Can someone point me to the way how to fix title to name? so "ā" becomes "a" and so on. see attachment

×
×
  • Create New...