I have a question regarding the creation of a multilingual website. In short I would like to send online a website and present it translated in 4 languages.
The most important thing is that the website is SEO friendly.
I have read several articles about this topic and some of them were published here.
In the end I decided to create sub-folders like this:
www.example.com/es for Spanish
www.example.com/de for German
and so on …
The main language will be English www.example.com.
Because it is the very first time I am dealing with this issue and I'd like to ask how to proceed.
At first sight, a similar approach makes me realize that each sub-folder www.example.com/es etc. will contain all the codes of the main site. This means that every time when I change something I have to copy/paste the change in each and every folder? Is there a more effective and dynamic way how to do that?
Rewrite URLs
E.g: mysite.com/en FOR mysite.com?lang=en
E.g 2: mysite.com/fr FOR mysite.com?lang=fr
Create a language array with combinaison of key => value in an inclusion file (e.g: inc.lang.php) such as
'en_apple' => Apple
'fr_apple' => Pomme
Replace terms to translate by your included array.
That's my way, it works for SEO (tested with Google tools) and it's light, because you have one directory to maintain for all your languages and it's invisible for users.
This is dynamic has you want, and you don't have to maintain 3 or 4 different folders each time you work on your website.
Hope it helps.
At first sight, a similar approach makes me realize that each
sub-folder www.example.com/es etc. will contain all the codes of the
main site. This means that every time when I change something I have
to copy/paste the change in each and every folder? Is there a more
effective and dynamic way how to do that?
No, you don't need to copy all the code of the main site. You only need to create the HTML content for each language and store it correspondingly in each directory. Then you need to learn about hreflang. It is not very hard, it is only about adding a couple of links in your header.
Related
So I set up PHP to use Gettext and translate my website /index.php based on the language.
Now I would like to have the URL different for each language ( exemple : mydomain.com/fr/ ). But each folder should point to the main directory and PHP will change the language depending from wiched URL the user is using ( mydomain.com/fr/ or mydomain.com/it/ ).
What is the best way to do it ?
It is only up to your imagination (and your regex skills :-B but even I got it and my regex skills are rather weak.)
You could do www.mysite.com/articoli/Sed_ut_perspiciatis_unde_omnis/4711/ for the italian article
and
www.mysite.com/articles/far_far_way_behind_the_word_mountains/4711/ for the english version of the same article (product)
and you rewrite the first to
www.mysite.com/article.php?lang=it?article_id=4711
and the second to
www.mysite.com/article.php?lang=en?article_id=4711
(The middle part is discarded - look at ebay ads other pages with categories - they do it like this )
Takes you two regexp rewrites.
Basically you have to think about a structure logical to SEO and intuitive for users wgo sees the url.
This depends also on: what are the most visited pages of your site?
I have eg. only 1 php script/page which is responsible for 90% of all web traffic.
It used to be 2 (one per german and 1 in english but now I have it "gettext'ed" and now its only one page so much less maintenance.
If SEO optimization is interesting for you - look at similar well known pages and their page /URL structure.
Only rewriting mysite.com/fr/bubalu.html to mysite.com/bubalu.php?lang=fr will be useful only if you have very few pages and I ask myself if this really explains your site structure best to crawlers..
I'm new with drupal 7 and now I'm having a hard time with theme's coding, if more specific, I don't know how I should show pre-defined content. Previous developer of project said, that I absolutly shouldn't use/hardcode any content and links directly in template files and I should put it to modules/blocks (with regions). It would be ok, but design I'm coding now is too complex and has much content and just writing module for each thing - it take too much time.
I have very similar design to this one:
http://classter-html.themerex.net/
So, what is the best and right way to show content (and links) in templates? Of course, I could just hardcode it, but I'm kind of person, who follows good practices.
Let's look at the example site you gave. In Drupal it would be set up something like this:
The carousell at the top: Slick
Classter Team: A View of content type "employee" displayed in a block.
The photos: A View of the files, or of a photo content type. Or one of multiple purpose built photo album modules.
Application Features: A block with custom HTML-code.
Things that only show up at one page (like the start page) can be done using full HTML in that nodes content. Views and blocks with HTML usually solves the rest.
If you are sure that some content will never change (is not translatable or something) I don't see why you shouldn't hard-code it.
Regarding hard-coded links, use root relative paths, so if you move your site to some other domain they will still work.
I have a quick question. We are building a site for a shop that has 12 different locations. So there is a Portal page, and then the 12 locations pages.
The design is the same for each location, just different text and rotator images. What I did before for another site was just used PHP and a Database, and had a site.php?shop=city&page=about and just did some rewrites so it would be /city/about/ which works good.
That way when I need to make an overall design change, it will apply to all locations instead of duplicating the site 12 times and if I catch one thing, I need to do it on all 12 sites.
One thing that we don't like about that is if someone in the team needs to make a change to the text, they would need to go in the MySQL Database to make the content changes which they are unfamiliar with. I could create a basic CMS but I would like some suggestions on what else I can do to make this easy on everyone.
If I need to create one of the sites and duplicate it 11 times, I could do that but was just seeing if there were any easier ways you guys know of, where it would still be easy for people to update the content with FTP.
Thanks!
From my point of view you have a few options:
Build a basic update form with a basic WYSIWYG editor, more or less a very basic CMS
Use an include file structure then the user only needs to edit a text file for example for changes to reflect on the site, note they may need to know basic HTML and FTP is likely to be required
Give access to phpMyAdmin, again note they may need to know a little HTML (edit: as already suggested I just noticed, sorry need to load answers while I'm typing)
Install an out of the box CMS in the 'locations' or 'stores' directory and only have it used on these pages
Personally I would just build a simple CMS in this case... then again I have built around 15 CMS' in the past so it only takes me about an hour to code something like this.
Hope that helps you.
It is not ftp, but if you gave them access to phpmyadmin, with a login that only has access to that table then they could edit the data.
Hello all and thanks in advance for taking a look and I appreciate any help possible. I'm an SEO guy and have inherited a CakePHP site that will serve content in three languages. I'd like to get a canonical (seo friendly) way to get a good multilingual URL architecture without making my developer too upset.
The end solution of what we want:
Nice URLs with three distinct URLs (translated) for each language. For example:
www.domain.com/L1/language-1-parent/language-1-child/
www.domain.com/L2/language-2-parent/language-2-child/
www.domain.com/L3/language-3-parent/language-3-child/
Here, we have one content piece. This content will be the same in all three languages, but it will be translated. Accordingly, we want the corresponding subdirectories and URIs to be translated as well, where:
L{1-3} are subdirectories indicating the language
language-{1-3} are 'controllers' for the content. Currently we only have one controller, regardless whether the language subdirectories are in a different language).
langauge-{1-3}-child are dependent content items or subdirectries that must also be translated based upon the language subdirectories
The Assumed Problem:
My developer is telling me that because Cake has controllers that serve the content up and as such having translations is a bit messy.
In the example above: I assume that 'language-1,' language-2,' and 'language-3' are the controllers.
Also, I'm assuming that because we're trying to serve up three content versions from one controller (with different URLs), we're running into a problem.
Currently we have URLs as such:
www.domain.com/L1/language-1-parent/language-1-child/
www.domain.com/L2/language-1-parent/language-1-child/
www.domain.com/L3/language-1-parent/language-1-child/
The problem here is that regardless whether a user selects a different language, we have the URLs that do not correspond and are not translated.
Also, we do have some content items that do not have other language translations. As such, I want to put in a rel=canonical meta tag on the pages without translations and/or noindex these pages whilst we{re working on translations.
Again, your help is MASSIVELY appreciated and I look forward to your responses. I'm happy to clarify anything.
With standard cakephp configuration you can easily achieve these kind of URLs using cakephp internationlization
/eng/users/account
/fre/users/account
If you need these king of URLs
/eng/users/account
/fre/utilisateurs/compte
Then you should play with your AppController.php
// pseudo code, you need to rewrite this section as you need.
var lang getUrlParams['language'];
var controller getUrlParams['controller'];
var action getUrlParams['action'];
if (controller[lang] != controller || action[lang] != action) :
redirect to `/lang/controller[lang]/action[lang]`;
endif;
In view's all links should be called like
$this->Html->link(__('My Link'), array('controller' => __('users'), 'controller' => __('account')))
So, currently I'm organizing my blog based on filename: To create a post I enter the name of the file. As opposed to storing the post in the database, I store them in PHP files. So each time I create a post, A new row in the table is created with the filename and a unique ID. To reference the post (e.g. for comments) I get the name of the current file, then search the entries table for a matching file name. The post ID of the comment matches the ID of that post.
Obviously this isn't the standard way of organizing a blog, but I do it this way for a few reasons:
Clean URL's (even cleaner than mod_rewrite can provide from what I've read)
I always have a hard copy of the post on my machine
Easier to remember the URL of a specific post (kind of a part of clean URL's)
Now I know that the standard way would be storing each post in the database. I know how to do this, but the clean URL's is the main problem. So now to my questions:
Is there anything WRONG with the way I'm doing it now, or could any problems arise from it in the future?
Can the same level of clean URL's that I can get now be achieved with mod_rewrite? If so, links are appreciated
I will be hosting this on a web host. Do only certain web-hosts provide access to the necessary files for mod_rewrite, or is it generally standard on all web-hosts?
Thanks so much guys!
P.S. To be clear, I don't plan on using a blogging engine.
As cletus said, this is similar to Movable Type. There's nothing inherently wrong with storing your data in files.
One thing that comes to mind is: how much are you storing in the files? Just the post content, or does each PHP file contain a copy of the entire design of the page as opposed to using a base template? How difficult would it be to change the design later on? This may or may not be a problem.
What exactly are you looking for in terms of clean URLs? Rewrite rules are quite powerful and flexible. By using mod_rewrite in conjunction with a main PHP file that answers all requests, you can pretty much have any URL format you want, including user-friendly URLs without obscure ID numbers or even file extensions.
Edit:
Here is how it would work with mod_rewrite and a main PHP file that processes requests:
Web server passes all requests (e.g., /my-post-title) to, say, index.php
index.php parses the request path ("my-post-title")
Look up "my-post-title" in the database's "slug" or "friendly name" (whatever you want to call it) column and locates the appropriate row that way
Retrieve the post from the database
Apply a template to the post data
Return the completed page to the client
This is essentially how systems like Drupal and WordPress work.
Also, regarding how Movable Type works, it's been a while since I've used it so I might be wrong, but I believe it stores all posts in the database. When you hit the publish button, it generates plain HTML files by pulling post data from the database and inserting it into a template. This is incredibly efficient when your site is under heavy load - there are no scripts running when a visitor opens up your website, and the server can keep up with heavy visitation when it only needs to serve up static files.
So obviously you've got a lot of options when figuring out how your solution should work. The one you proposed sounds fine, though you might want to give careful consideration to how you'll maintain a large number of posts in individual files, particularly if you want to change the design of the entire site later on. You might want to consider a templating engine like Smarty, and just store post data (no layout tags) in your individual files, for instance. Or just use some basic include() statements in your post files to suck in headers, footers, nav menus, etc.
What you're describing is kind of like how Movable Type works. The issues you'll need to cover are:
Syndication: RSS/Atom;
Sitemap: for Google;
Commenting; and
Tagging and filtering content.
It's not unreasonable not to use a database. If I were to do that I'd be using a templating engine like Smarty that does a better job of caching the results than PHP will out of the box.