Setting up multilingual site with sitefinity in the form of mysite.com/us/home, mysite.com/fr/home - multilingual

Trying to set up a multilingual site with sitefinity.
The structure is
mysite.com/us/ - all US content
mysite.com/fr/ - all French content
So, the home page for the US would be at
mysite.com/us/home
and the home page for France would be at
mysite.com/fr/home
How can I do that?
Site search should be limited to the currently selected locale (/fr/ or /us/ in this example).
What happens by default is that the US home page ends up in the root of the site, and the French under /fr/:
mysite.com/home #US version, should appear under mysite.com/us/home
mysite.com/fr/home #French version

You can manage the languages you would like to support by going to Administration->Settings and then select "Languages" from the menu on the left.
Here is a video that goes into more detail.
Enabling and Creating Multilingual Sitefinity Pages and Content

You could set up a 'dummy' default language which would route to mysite.com/home and then add US and FR as secondary languages. Then in mysite.com/home you could add some logic to decide which language folder homepage to route to, or simply add something like this in the page html to auto redirect to the US homepage:
<script>
window.location.replace('mysite.com/us/home');
</script>

Related

How to add Pagination to a Hugo theme

I am using Hugo (https://gohugo.io/) with the PaperMod theme (https://github.com/adityatelange/hugo-PaperMod).
Now I created a page where I want to post pictures. But the page will be very big after some month. So thats why I want to add pagination. There should be only 5 or 10 pictures per page. At the bottom the user can click through the other pages.
How can I do this? I'm a noob in editing templates so I do not understand how to follow the docs: https://gohugo.io/templates/pagination/
Maybe someone can help and tell me what I need to edit?
Page: https://i.ibb.co/1QzyRm9/ed6ebc2c5f3b83eed63ac93cfd7b8763.png
Thank you very much...
That theme seems to already use the Pagination feature that Hugo has, so there is no need for you to change the template.
If you check the Hugo documentation on configuring pagination, you'll see that there is a setting for the item count.
# config.toml
paginate = 10
You need to update your own config.toml file with this key, and set it to whatever you need, e.g. 5.
You can try changing the value, and creating some posts there, to double-check that it's working properly.

Multi-lingual Ghost with same slug

I'd like to create a multi-lingual Ghost CMS website, using the same slugs across multi-lingual posts.
e.g.
EN: my-site.com/hello-world
FR: my-site.com/fr/hello-world
I understand from this walkthrough that I need to create the same post multiple times for each language and the slug must be unique. In order to keep things consistent, I'd like to use the same slug (i.e. hello-world) for the same post across each language. Is there a way to do this, perhaps with dynamic routing?
Just thought I'd let you know that we've updated the tutorial you linked to on using different languages in Ghost: https://ghost.org/tutorials/multi-language-content/
You can use matching slugs (I assume you're doing this so you can easily switch languages with a button?) but I wouldn't recommend it as the slug might be used as part of your SEO. A slug written in english isn't going to work as well if someone is searching in french.
The tutorial shows how to create multi-language content and to use <link> elements to add the alternative translations to the meta data. I've created a CodePen demo here on how to create a language select in JavaScript which hooks into those elements: https://codepen.io/daviddarnes/pen/QWwzePz
Hope this helps!
Here is a workaround to achieve that :
Create a template file hello_world.hbs
Update the routes.yaml file as follow
/hello-world/:
template: hello_world # referencing hello_world.hbs
data: page.hello-world # You need to create a page from admin that have slug : /hello-world
/en/hello-world/:
template: hello_world # referencing hello_world.hbs
data: page.hello-word-en # You need to create a page from admin that have slug : /hello-world-en
Write the code of the page in your hello_world.hbs and you can display the content of the page by using the {{#post}}{{/post}} block
🤗 Voila! You have your multi-language pages with same slug

Create Landing Page in Drupal 7

In Drupal one can basically style the elements, like the search box, or the basic page etc. and then put some content in the site and the resulting page will be generated. But what if you want one specific site (e.g. the index page) to be different? E.g. have a image as a background, a different navigation styling etc.
What's the best paractice way of doing this?
Best practice is to have a different theme which you can switch to by using hook_custom_theme() where you check the current path. Also make sure that your theme to switch to is enabled:
/**
* Implements hook_custom_theme().
*/
function YOUR_MODULE_custom_theme() {
# check path with arg(0)
# return theme name to switch to
return 'different_theme_machine_name';
}
Alternatively you can also try ThemeKey doing this out of the box with an interface & allowing you the specify rules.
If you need to change only the content(body) section of your page, use Disply Suite. You can create unique look and feel layouts for your body section of each page.
If you trying to change the complete layout of one page (eg: Services), Create new Content Type 'Services'. Then create a template file for this content type, You must name this template call page--services.tpl.php. And also you can overwrite the index page layout by creating page--front.tpl.php template. Done!
What you are saying you want to change is all styling. And you know you can do a page to look drastically different with CSS... and you can do it that way depending on your chosen Drupal theme.
Now, with the Chrome Inspector (or FF inspector) look at the body tag, it probably has many classes which indicates in what page you are, what type of node (if it's a node) or if it's an admin section, or an anonymous user.
Using those specific classes you can style a frontpage, or a view, or a node, or anything, without installing more modules... with some limitations because you can't change rendered HTML this way.
Finally, don't get scared by using modules in Drupal, it's how Drupal works and it works pretty well. The thing is to install the best tools to increase your productivity, and Drupal have excellent options to change your theming and content like Display Suite (like #BaikHo suggested).
Hope that helps.
PD: Using the less module and with custom your theme you can have LESS css which is considerably faster than using only CSS, and because it's integrated with Drupal you can theme make everything even faster. Give it a try.

Managing dynamic, responsive content at the backend in Silverstripe

I am currently trying to jazz up a SilverStripe site by making the content more engaging. The site is responsive, but all this means currently is that the navigation bar/header snaps to a more mobile friendly style when it hits the mobile break point.
The long and short of it is, my main page.ss is this:
<html>
<head>
<title>$Title</title>
</head>
<body>
$Header
$Layout
$Footer
</body>
</html>
With $Layout rendering a few variations of a basic page. We have a couple of layouts that aim to give our webmaster pages that are a bit more engaging - for example we have an accordion type page that has many accordion section DataObjects, that present the page as an accordion page with the open/shut javascript functionality.
But this is not enough. I want to give the webmaster more flexibility in the CMS to create interesting pages, without me having to create hundreds of different page types.
I'm thinking of creating a module that gets rid of the main $Content field for all pages, and instead inserts a sort of grid system management field. The webmaster can add rows (one DataObject) and then split those rows into sections (another DataObject). The sections will have a content field managed by TinyMCE, just like a page has. Then on the front end I will map these rows and sections to a responsive grid system.
For variations on the sections, I will add classes (a bit like having different page types) that render slightly differently. The sections will have .ss and .css (and possibly .js) to control their own look and feel.
My question is, how have other people approached this problem? Does my idea sound like overkill? Or does it sound like a good idea for a module?
-
For some examples of what I am trying to achieve, this page is a good example:
http://www.wingsforlife.com/en/research/
Content is split up into various sections, which allows for better control when the page is resized. Also throughout the site, content is varied, sometimes it will be in a single column, other times two, which snaps to one column when the window is smaller.
On the home page, if you scroll down, there are 4 links that are presented inside circles, that contain a number and some text: http://www.wingsforlife.com/en/
This is something I can't see being possible inside TinyMCE (which is fair enough as TinyMCE is just a basic content editor, not a web design tool).
Have a look at https://github.com/burnbright/silverstripe-widgetpages for an implementation of using Widgets to compose a webpage. Also https://github.com/g4b0/silverstripe-widget-pages-extension.
this can easily be achieved by replacing the HTMLEditorField that's linked to the Content field in the database by some GridField, managing DataObjects that make up what you might call 'ContentParts'. we've already used this approach in some projects to allow for more rendering flexibility of content elements.
simply tie some DataObjects to your Page class:
private static $has_many = array(
'ContentParts' => 'ContentPart'
);
then, use a GridField to manage them in your getCMSFields:
$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$field_ContentParts = new GridField('ContentParts', 'Content Parts', $this->ContentParts(), $gridFieldConfig);
simplest way to render them in your template is as follows:
<% loop ContentParts %>
<section>...</section>
<% end_loop %>
of course you'll want to have different contentparts, so you might want to create subclasses of ContentPart with their custom fields and use the GridFieldAddNewMultiClass component to add them to your GridField (it's part of the GridFieldExtensions module, to be found here: https://github.com/ajshort/silverstripe-gridfieldextensions)
hth

How to setup Drupal multi language site?

I was searched and read many websites but can't find how to set up drupal multi language website.
I want to use 2 languages in a site.
These 2 languages have different content. (not content translation).
I had enabled Locale module, enabled multilingual support in each content type
but when i was added content in 2 languages
the front page list all of those articles without filter the site's language.
how to setup drupal 7 to list articles with filtered language.
eg:
http://example.com/en <- this url should list all english article.
http://example.com/fr <- this url should list all france article.
I have to install i18n or Internationalization module from Drupal contributed modules and enabled these option.
Multilingual select
Internationalization
** This module require Variable module.
Since the content is different, one way to achieve this is by creating two different content types. Assign an alias pattern to each content type like en/[node:title] and fr/[node:title]. You can then display each or both content types on any page; it could be a taxonomy page with alias en or fr. If you choose this method you won't need locale. This one is not intended for translated sites where each content has a matching translated content.
If you also want to expand some special words which have not include in language lib, you can try following code:
$zh = variable_get('locale_custom_strings_zh-hans');//zh-hans is your language key.
$zh["More news"] = '更多信息'; // KEY/VALUE
variable_set('locale_custom_strings_zh-hans',$zh); // set it back.

Resources