I have a large PHP based website with hundreds of files. All internal links are root relative, in this format:
News Homepage
<a href="/news/article-title-here/">Article<a>
Contact Us
I am planning to localize the website (using gettext) into subdirectory structure, for example French language would point to:
News
Article Title
Contact Us
Other languages would similarly point into their relevant subdirectories.
I know I could modify all links and add some sort of language variable, e.g.
News
However, I would like to do avoid going through all files and updating all links manually this way. Is there a way to achieve this without modifying the existing links? I looked around and tested some URL Rewrite solutions, <base-href> tag based solutions (does not work for root relative links), but could not find anything that would work reliably. Any help is appreciated.
Related
I'm trying to setup proper solution for multilingual website generated using Jekyll. I checked some plugins and tricks without plugin. But still not sure how to achieve it. I found that it's possible to generate output of every language into subfolder. Eg.:
/en/ contains English version of website
/cz/ contains Czech version of website
But in my case every language will be published on own domain (example.com, example.cz). And this is the moment where I'm getting some troubles with the implementation. When I'll have every language in own folder (/en/, /cz/) this means that also {{page.url}} and parmalinks will contain that /en/... or /cz/... part.
Could you help me to find the trick I need to use? What is correct setup in this case?
Note: The only solution which is close to my situation is this https://frozenfractal.com/blog/2016/5/13/building-a-multilingual-website-in-jekyll/ Here is not possible to implement language switcher because solution excludes all files in alternative languages. (When I'll be on www.example.com/contact I need to be able to switch to Czech alternative www.example.cz/kontakt.)
Two different urls makes sense to me. Google will have a different page rank for your sites, but that is the only downside I can think of. I would set the language and set alternate tags. You can use your page front matter to fill the alternate tags. If you succeed in building them from one repo, you might be able to automatically match the different language versions of your pages with an english page identifier (for your alternate tags). Source
I want my website to have indentation in google result search.
After taking reference of many websites, I found this one website "www.traveloka.com"
Inside the website, I can't find any meta keywords stuffs.
But the website is well indented.
My question is :
- does meta keywords really needed to have google indent my search result ?
- if yes, why the website www.traveloka.com is well indented without meta keywords ?
- if no, what matters then ? Beside having the page have href linking to each other ?
UPDATE :
While doing SEO, I found this website :
chlooe.com
It reports SEO advises, which ones to be changed, etc.
I'll follow the instructions there. any thoughts ?
If by indentation you mean ... it's called sublinks.
Meta tags are no longer important for most search engines. They now rank the pages according to content so in your site's content, use strong keywords to get better ranking.
Having a specific page title helps a lot too.
As for the meta tags, personally, I like to leave it in but they are no longer mandatory.
The Google site links are generated automatically by Google depending on your content.
Here are a few tips:
1) Have a sitemap.xml in your website. This will tell the crawlers which pages are available on your site. To generate a sitemap.xml, I use http://www.xml-sitemaps.com/
2) Submit that sitemap to google webmaster tools.
3) Use clean urls. For example www.mydomain.com/contact, .../about-us, .../portfolio, ... etc. These help search engines seperate the content and create sub links depending on the most important content.
4) Most important of all, get traffic on your website... no traffic = poor ranking.
This is not a full tutorial but just some tips. Search for "google sub links" to learn more.
Hope this helps
https://support.google.com/webmasters/answer/47334?hl=en
I don't know a huge amount about htacess and modrewrite, so I find myself in yet another predicament approaching this new zone for myself.
I will seperate my Inquiries over 2 different questions to allow answers to be on-topic and better targetted to users searching for solutions to their own questions.
This is the second of those 2 inquiries;
I have the following in my htaccess file;
RewriteRule ^install/([a-zA-Z0-9]+)/$ index.php?module=faq&page=howto&program=$1
The concept is that install/abcd/ would call index.php?module=faq&page=howto&program=abcd
That works. It pulls the content, matches it and shows what it is meant to. I have used server variables to show me what is being simulated and it matches up.
However the CSS and images on the page are being stripped as they are relative to the document, not statically assigned.
I am only using htaccess (For Now I guess?) for one solution, with the intention to soon impliment another fairly soon. The intention is to offer our customers easy to read URL's for support purposes, but not rewriting the entire site. SEO isnt a major issue as our site is only to be used by those it is intended for as opposed to a wide audience.
Other than statically assigning css, JS and image files, is there a way to fix this issue so that the page is displayed styled and with the javascript in tact?
Thanks for your help, I hope the question was understandable and as always I appreciate the time you guys take to help us all!
We need to either make the css links absolute (starts with a /) or add a base for all our relative links by adding an extra attribute to the header:
<base href="/">
This would mean that you we start with the subdirectory of /test/. so instead of the css being;
http://domain.com/install/abcd/style.css
It would instead
http://domain.com/style.css
This is the problem I was having due to all my CSS and JS being included relativly (Allowing me to change the directory my script is in).
The above adjustment has in fact fixed my original problem, however without the use of PHP may open up an issue for some who want to be able to deploy the scripts and allow them to be fully dynamic without having to edit the base. Good luck!
I was wondering what would be the best way to achieve a multi-language template based website. So say I want to offer my website in Englisch and German there are some different methods. My interest is mainly about SEO, so which would be the best way for search engines.
The first way that I often see is using different directories for each language, for example www.example.com for English and www.example.com/de/ for the German translation. The disadvantage of this is: when changing a file, ist has to be changed in every directory manually. And for search engines the two directories would be concerned as duplicate content, wouldnt they?
The second way I know is just using some GET value like www.example.com?lang=de and then setting a cookie. But this way search engines probably wont even find the different languages.
So is there another way or which one is the best?
I worked on internationalised websites until this year. The advice we always had from SEO gurus was to discriminate language based on URL - so, www.example.com/en and www.example.com/de.
I think this is also better for users; if i bookmark a page in German, then when i come back to it, i get a page in German even if my cookies have expired. Similarly, i can do things like post the URL on Facebook, and have my German-speaking friends click on it and get a site in German.
Note that if your site serves multiple countries, you should handle those along with language - so, you might have example.com/de-DE, example.com/en-GB, example.com/en-IE, etc.
However, this should not involve duplication. Instead, you should set your application up to process the URL, extract the locale information, and then forward the request internally to a locale-independent page. So, a request for example.com/de-DE/info and a request for example.com/en-IE/info should both be passed to /info.jsp (or i'm guessing info.php in your case). That page should then be coded to emit text in the appropriate language, using a page-level localisation mechanism.
Things are a bit trickier if you want the URLs themselves to be localised (eg example.org/de-DE/anmelden vs example.org/en-IE/sign-in). However, the same principle applies: extract the locale, then forward to a common page. The difference is that there must be more sophistication in figuring out what the page is from the URL; you will need a mapping from natural language in the URL to the page filename.
We are creating a site template that among other things has a Document library with MANY sub folders and a Link list that contains shortcut links to the depths of the DocLib. While making the Site template we are checking the box to 'Include Content.' We are using Sharepoint 2010. No MOSS.
Our problem: Once we make a site from the template, the shortcut links don't work. While the first part of the link URL is rewritten, there is a portion of the original site name still buried in the URL.
My Question: Is there a way to create a relative links to content inside of the site, so that the the site name isn't included? or is there a variable I can use to represent th current site? or do I have to programmatically 'fix-up' the links after it's created? or some other better option?
There is a way, but you will have to do your work in master pages. The following tag is rendered in a sharepoint 2010 master page as ahref, and the relativity is passed on to sites created as templates.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/SitePages/dashboard.aspx" id="v3idNavLinkTrackerDash" Text="Now is the time for all good men." />
I think you may have come across one of the many limitations of using templates. I don't know of any way to change this behavior when using templates.
However, you mentioned programming. If you are deploying customizations, you might look into site definitions or feature stapling with code to populate the list.
On the no code side, you might have some options if there is some flexibiility in execution of the site. If you really need the sub folders and the template method, you might look at replacing the link list with a page. If the page content is a list of links, they will be relative. If your structure is flexible, another option is to remove the sub folders. You could add a field for category that you can group by instead. Or, you could create seperate document libraries instead of using folders.