Search Engine Friendly URL, differently to the link name

kweitzel

The Trick is you have to change the "pages folder" BEFORE you add any page ...

cheers

Klaus

testdriver2

I am just experimenting a little bit to get my WebsiteBaker optimized for seo. I have just found another site in this forum dealing with this issue for Version 2.7: https://forum.websitebaker.org/index.php?topic=10661.0
But also this one does not answer my current problem. I am trying to get rid of the "pages" folder. It only works on some servers but not on all. Does anybody have code that works on all servers?

ruebenwurzel

Hello,

this changes are based on an older version of WB. So they are not compatible to the upcoming WB 2.7.

Matthias

Frediwan

hello ,

are these changes of danfuh possible with existing pages?

gruß
frediwan

amadeus

Hi there, I´m a reader of this forum since some month, and got a lot of help until now - many many thanks to this great community!

Quotethink it would be better only to have an option where you can decide if the url is generated from menulink or the pagetitle. This way you can use the pagetitle for your keywords and we can make this option downwords kompatible to older WB vesions. Maybe default option is to use the menulink as before and have only an option (per page) where you can activate pagetitle for url generation. What do you think about this?

I would also like this feature very much, is there a solution for now, which I can do by myself? I´m not a hardcore php coder but get used to more and more  :wink:

ruebenwurzel

Hello

Quoteexample:
So, that every url/filename is without "My Site"

pagetitles (meta tag):
My Site - Home of my Site
My Site - Contact us via Mail or Phone
My Site - View our latest News

Thats very easy, only call the page Title in the meta tags with

<?php page_title('','[PAGE_TITLE]'); ?>

Gives the following result:
Home of my Site
Contact us via Mail or Phone
View our latest News

without the My Site at the beginning and without changing core code files.

And for the switching part i think we only have to change the filename generation to support additional the pagetitle and only add at page settings a option box at the page title and if this is activated the filename is generated from the pagetitle and not from the menülink. Only ideas, will ask the developpers if it is possible.

Matthias

danfuh

That is a great idea, but then, pleas without the page-title prefix in the url

example:
pagetitles (meta tag):
My Site - Home of my Site
My Site - Contact us via Mail or Phone
My Site - View our latest News

Menu Links:
Home
Contact
News

URLs:
home-of-my-site.php
contact-us-via-mail-or-phone.php
view-our-latest-news.php

So, that every url/filename is without "My Site"

Where do you want to crate a Switcher, where you can select between URL/Filename creation by Menuname or Title Tag.
Global in the options or for every page?

Daniel

p.s. what do you think about a modul with additional funktiuons link mine above?.
In function, linke the page cloner modul.

ruebenwurzel

Hello,

as i understood you the URL is always generated from the menulink and you wanna have a userdefined url and for this you added the new field.

I think it would be better only to have an option where you can decide if the url is generated from menulink or the pagetitle. This way you can use the pagetitle for your keywords and we can make this option downwords kompatible to older WB vesions. Maybe default option is to use the menulink as before and have only an option (per page) where you can activate pagetitle for url generation. What do you think about this?

Matthias

danfuh

Hello

The page extension is set in the advanced options.

The displayed extension is the result of the actuel setting.

For some search engines, it is better to put the keyword into the url. But if the menu width is smaller then the keyword, it would be better to have the possibility to change the url, without changing the menulink.
In this case, an additional field for url is needed.

Daniel


ruebenwurzel

Hello,

Why didn't you use the built in options of WB?

You can set the page extension to .html in the advanced options. And in combination with a fixed convert.php you got the result you want. An additional field for Url is not needed, because the pagetitle can be used this.

Changing core files affects that you have to do this changes on every update of WB again.

Matthias

danfuh

My solution is a new input form for every page, where you can change the URL/Filename different to the menulink.



I've done the following changes

inside the file /admin/pages/settings.php

approx. line 61
before:

// Get display name of person who last modified the page
$user=$admin->get_user_details($results_array['modified_by']);


after:

// Get display name of person who last modified the page
$user=$admin->get_user_details($results_array['modified_by']);

// Get Page Extension (Filename Suffix)
$database = new database();
$query = "SELECT * FROM ".TABLE_PREFIX."settings WHERE name = 'page_extension'";
$result = $database->query($query);
$result_array_extension = $result->fetchRow();


approx. line 82
before:

$template->set_var(array(
                                'PAGE_ID' => $results_array['page_id'],
                                'PAGE_TITLE' => ($results_array['page_title']),
                                'MENU_TITLE' => ($results_array['menu_title']),
                                'DESCRIPTION' => ($results_array['description']),
                                'KEYWORDS' => ($results_array['keywords']),
                                'MODIFIED_BY' => $user['display_name'],
                                'MODIFIED_BY_USERNAME' => $user['username'],
                                'MODIFIED_WHEN' => $modified_ts,
                                'ADMIN_URL' => ADMIN_URL
                                )
                         );


after:

$template->set_var(array(
                                'PAGE_ID' => $results_array['page_id'],
                                'PAGE_LINK' => ($results_array['link']),
                                'PAGE_EXTENSION' => ($result_array_extension['value']),
                                'PAGE_TITLE' => ($results_array['page_title']),
                                'MENU_TITLE' => ($results_array['menu_title']),
                                'DESCRIPTION' => ($results_array['description']),
                                'KEYWORDS' => ($results_array['keywords']),
                                'MODIFIED_BY' => $user['display_name'],
                                'MODIFIED_BY_USERNAME' => $user['username'],
                                'MODIFIED_WHEN' => $modified_ts,
                                'ADMIN_URL' => ADMIN_URL
                                )
                         );


inside the file /admin/pages/settings.html
approx. line 68 - 73

before:

<tr height="20">
        <td width="100" height="20">{TEXT_MENU_TITLE}:</td>
        <td with="240" height="20">
                <input type="text" name="menu_title" value="{MENU_TITLE}" style="width: 232px;" />
        </td>
</tr>


after:

<tr height="20">
        <td width="100" height="20">URL:</td>
        <td with="240" height="20">
                <input type="text" name="link" value="{PAGE_LINK}" style="width: 205px;" />{PAGE_EXTENSION}
        </td>
</tr>
<tr height="20">
        <td width="100" height="20">{TEXT_MENU_TITLE}:</td>
        <td with="240" height="20">
                <input type="text" name="menu_title" value="{MENU_TITLE}" style="width: 232px;" />
        </td>
</tr>


inside the file /admin/pages/settings2.php
approx. line 43

before:

// Get values
$page_title = $admin->add_slashes($admin->get_post('page_title'));


after:

// Get values
$page_link = $admin->add_slashes($admin->get_post('link'));
$page_title = $admin->add_slashes($admin->get_post('page_title'));



approx. line 115
before:

// Work-out what the link should be
if($parent == '0') {
        $link = '/'.page_filename($menu_title);
        $filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($menu_title).'.php';
} else {
        $parent_section = '';
        $parent_titles = array_reverse(get_parent_titles($parent));
        foreach($parent_titles AS $parent_title) {
                $parent_section .= page_filename($parent_title).'/';
        }
        if($parent_section == '/') { $parent_section = ''; }
        $link = '/'.$parent_section.page_filename($menu_title);
        $filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($menu_title).'.php';
}
if($parent == '0') {
        $link = '/'.page_filename($menu_title);
        $filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($menu_title).'.php';
} else {
        $parent_section = '';
        $parent_titles = array_reverse(get_parent_titles($parent));
        foreach($parent_titles AS $parent_title) {
                $parent_section .= page_filename($parent_title).'/';
        }
        if($parent_section == '/') { $parent_section = ''; }
        $link = '/'.$parent_section.page_filename($menu_title);
        $filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($menu_title).'.php';
}



after:
// Work-out what the link should be
if($parent == '0') {
        if($page_link != '') {
                $link = '/'.page_filename($page_link);
                $filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($page_link).'.php';
        } else {
                $link = '/'.page_filename($menu_title);
                $filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($menu_title).'.php';
        }
} else {
        $parent_section = '';
        $parent_titles = array_reverse(get_parent_titles($parent));
        foreach($parent_titles AS $parent_title) {
                $parent_section .= page_filename($parent_title).'/';
        }
        if($parent_section == '/') { $parent_section = ''; }
        if($page_link != '') {
                $link = '/'.$parent_section.page_filename($page_link);
                $filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($page_link).'.php';
        } else {
                $link = '/'.$parent_section.page_filename($menu_title);
                $filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($menu_title).'.php';
        }
}


That is it  :-D

danfuh

Thank You,

I try to change
settings.php
settings.html
and
settings2.php

If i would have a additional input form for every page, i can change the URL and filename total different to the menu link.
Like this:
menu link: Home -> contact -> disclaimer
URL: http://mysite.com/disclaimer.html

when i've finished the source-code changes, i will port my solution here.

kweitzel

have a look into the file "convert(.)php", this is the conversion chart for these special characters ... by editing this file you can write your own rewriting conventions.

cheers

Klaus

danfuh

Hello

first of all, sorry for my bad english.
I would like that my URL is different to the menu link.
Currently, the menu entry link is Gästebuch and the URL is  gE4stebuch.html
I would that the URL is named gaestebuch.html

Is there any solution to arrange the URL different to the menu name?
It is no problem to change this inside the database, but I would like to handle this in the admin-backend.

Thank you in advance,

Daniel