The essential news about content management systems and mobile technology. Powered by Perfect Publisher and XT Search for Algolia.
The News Site publishes posts to the following channels: Facebook, Instagram, Twitter, Telegram, Web Push, Tumblr, and Blogger.
Read more https://build.prestashop-project.org/news/2023/live-update-9-2023/
Are you driven by a desire to share your knowledge and expertise with the world? Do you feel the pull of making an impact but aren’t sure how to leverage your skills? In today’s digital economy, there’s an abundance of opportunity, but sometimes the path is anything but clear. That’s why we’ve crafted a comprehensive guide to help you navigate this exciting journey.
Unlock your future with our brand-new course: Building Online Courses.
We’ve taken the essence of building compelling, flexible, and effective online courses and distilled it into actionable insights. This course is a treasure trove of strategies designed to help you bring your unique skills to a global classroom. Let’s delve into why this course is essential for aspiring educators like you.
Imagine breaking free from geographical and time constraints. That’s the power of online courses—they’re a stage for you to share your skills and knowledge with a global audience. Here’s why that’s a game-changer:
Choose from a variety of course setup options. Are you a fan of simplicity? WordPress.com’s built-in features, like pages and posts, make course building a breeze. Prefer a structured approach with advanced features? Our Learning Management System (LMS) options like Sensei offer robust frameworks for a more comprehensive learning experience. In Building Online Courses we cover them all and guide you through how each option works.
As an added bonus, we’re also offering a webinar: Effortless Course Creation: Sensei LMS + WordPress.com for two live sessions in October (the recorded replay will be available after that).
We don’t stop at the “how”—we also dive into the “why,” helping you map out a meaningful and coherent educational pathway. From determining course frequency to crafting a compelling sales page, every lesson is a stepping stone to elevate your teaching and, in turn, enrich your students’ lives.
Join us as we break down barriers and redefine the landscape of online education. Whether you’re an expert or someone who’s just a few steps ahead of the audience you wish to serve, this course will set you on a path to success.
Ready to turn your passion into impact? Dive into the enriching world of Building Online Courses and become the educator the world needs.
Are you excited? So are we. Let’s build your future in education, together.
Get started right nowRead more https://wordpress.com/blog/2023/10/16/building-an-online-course/
According to Google, most sites would benefit from a sitemap, which helps bots know what pages should be crawled.
A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to crawl your site more efficiently. A sitemap tells Google which pages and files you think are important in your site, and also provides valuable information about these files. For example, when the page was last updated and any alternate language versions of the page.
It's possible to create these manually, and we have a tutorial on how to create a sitemap manually here, but a package named "laravel-sitemap" from Spatie makes creating a sitemap easier than ever.
<iframe width="560" height="315" src="https://www.youtube.com/embed/nRZqJ0MQGbQ?si=rG3tieip8w2Ri6tS" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>One of the benefits of the package is it supplies two methods of creating a sitemap. The first is it can automatically crawl your site and build it based on internal links, or you can have full control and build it manually.
All you need to do for auto crawling is install the packakge and then tell it the URL to start crawling.
use Spatie\Sitemap\SitemapGenerator;
$path = public_path('sitemap.xml');
SitemapGenerator::create('https://example.com')->writeToFile($path);
The generator can execute JavaScript on each page, so links injected into the dom by JavaScript will also be crawled.
I'm using this here on Laravel News because we have thousands of pages that need to be added to the index. To set this up, first apply the code to your models:
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;
class Article extends Model implements Sitemapable
{
public function toSitemapTag(): Url | string | array
{
return Url::create(route('article.details', $this))
->setLastModificationDate(Carbon::create($this->updated_at))
->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY)
->setPriority(0.1);
}
}
Then, you can generate your sitemap like this:
use Spatie\Sitemap\Sitemap;
Sitemap::create()
->add(Post::all()
->writeToFile(public_path('sitemap.xml'));
As mentioned, we are using the manual setup and here is the full code to generate our sitemap:
Sitemap::create()
->add($this->build_index(Article::active()->get(), 'sitemap_articles.xml'))
->add($this->build_index(Partner::active()->get(), 'sitemap_partners.xml'))
->add($this->build_index(Category::all(), 'sitemap_categories.xml'))
->add($this->build_index(Package::all(), 'sitemap_packages.xml'))
->add(Url::create('/')->setPriority(1)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/newsletter')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_MONTHLY))
->add(Url::create('/popular-laravel-packages')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_MONTHLY))
->add(Url::create('/links')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/links/new')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/partners')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/partners/agencies')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/partners/tools')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->add(Url::create('/partners/education')->setPriority(0.5)->setChangeFrequency(Url::CHANGE_FREQUENCY_ALWAYS))
->writeToFile(public_path('sitemap.xml'));
The first part builds out the indexes with lots of results, then we manually add pages that are from the main navigation. The included video has complete details.
See the officia package for complete details on set up, configuration, and usage for your application.
The post Building a Sitemap in your Laravel app with the Spatie Sitemap appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/laravel-automatic-sitemap
Let's say you have a paragraph of text with all sorts of weird formatting. Maybe it's from someone copying and pasting text into your CMS, or it's just in a weird state. Something like this:
$paragraph = "hello this is a test \n \t just a test and stuff ";
As you can see, it has extra spaces, a newline character, a tab character, and just oddly formatted.
Laravel provides a great solution to this called the
squish
method on the String helpers.
str($paragraph)->squish();
After running it through squish
you'll get all that
extra stuff removed:
"hello this is a test just a test and stuff"
Under the hood here is what this method actually does:
/**
* Remove all "extra" blank space from the given string.
*
* @param string $value
* @return string
*/
public static function squish($value)
{
return preg_replace('~(\s|\x{3164}|\x{1160})+~u', ' ', preg_replace('~^[\s\x{FEFF}]+|[\s\x{FEFF}]+$~u', '', $value));
}
Here is an explanation:
preg_replace
removes leading and
trailing white spaces or BOM characters.preg_replace
replaces one or more
consecutive white spaces or special fillers with a single
space.This ensures that you get a string with no extra white spaces.
Prefer to see a video, here is a short Reel I made for the @laravelnews Instagram page covering this:
<script async src="https://laravel-news.com//www.instagram.com/embed.js"></script>View this post on Instagram
The post How to remove all extra spaces in a string with Laravel appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/how-to-remove-all-extra-spaces-in-a-string-with-laravel
The Laravel LangCountry is a localization package that provides automatic date formatting, language switching, and more. Defining language detection and configuration can be tedious, so this package can make it easier to support multiple locales and the following feature list:
The optional language switcher UI could be something that you present to users, or use a development tool to switch languages to test quickly:
The provided middleware is useful as it will automatically try to detect the user's language preference and country. You can provide a fallback locale, which the middleware will set if there is no match between language and country. Finally, the middleware will check if you have translations for the selected locale and set the Laravel application locale to the locale (if found).
Lastly, this package provides date, time, and language helpers that you might find useful:
// nl-NL will return "27-09-2023"
// en-US will return "09/27/2023"
// de-DE will return "27.09.2023"
LangCountry::dateNumbers($post->created_at);
// nl-NL will return "27 september"
// en-US will return "September 27th"
LangCountry::dateBirthday($user->date_of_birth);
// en-GB" will return "🇬🇧"
// nl-NL will return "🇳🇱"
LangCountry::emojiFlag();
There are many helpers in the package's official documentation, which you can use to find usage and installation instructions. This package requires Laravel 10 and at least PHP 8.1. The project does provide a specific version for older Laravel versions. You can also view the source code on GitHub.
The post LangCountry is a Localization Package for Laravel appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/laravel-langcountry-localization