Home Blog Page 2

Simple Experiment – ​​Volcano Erupts


A volcano is an active volcano that has a stomach full of boiling lava. Indonesia is home to several volcanoes. There have been several volcanic eruptions. There are numerous volcanoes in East Java that have erupted in the past. Mount Kelud in the Kediri district was one of the volcanoes that ever erupted. Do you know what causes volcanoes to erupt? This experiment will demonstrate how volcanic eruptions take place.

In Laravel, Here’s How to Make a Dynamic Sitemap

A sitemap is an important part of blog management. Its purpose is to make crawling and indexing of our blog content more convenient for search engines. This will, of course, affect the visibility of our material or articles in search engine results. However, this does not rule out the possibility of search engines indexing a site without a sitemap. This is not the case.

Preparing to Make a Sitemap

The url (loc), the last modified date (lastmod), how often it was changed (changefreq), and priority are the most important components to include in a sitemap . The url and the last modified date are the most active of the four elements. Two elements will be made dynamic in this post, while the other two will be made static.

For example, in this discussion, an Eloquent Post Model will be created which contains post_title, post_content, slug, created_at, and updated_at. From this model, the fields that will be used in the sitemap are only slug and updated_at. An example of a migration file that is created is more or less like below.

Schema::create('posts', function (Blueprint $table) {
    $table->string('slug', 200)->unique()->index();

Add the storage configuration in the file config/filesystems.php in section links:

public_path('sitemap') => storage_path('app/sitemap'),

Make a Command Sitemap Generator

The sitemap made in this tutorial is in the form of an xml file that will be updated every 12 p.m. The reason is written as a file so that when the sitemap is crawled by multiple search engine bots at the same time, the server is not overburdened because direct database queries are performed.

The following command can be used to make commands in Laravel:

php artisan make:command SitemapGenerator

Open file Sitemapgenerator.php which is located in app/Console/Commands. Change the following sections:

protected $signature = 'sitemap:generate';

The code above makes a command that can be executed using CMD: php artisan sitemap:generate

protected $description = 'Command to make a sitemap';
public function handle()
    $posts = Post::latest()->limit(5000)->get();
    Storage::put('sitemap/post-sitemap.xml', View::make('sitemap.single-sitemap', ['data' => $posts]));

Making Templates for Sitemaps

Make a folder named sitemap in resources/view. In that folder add a file single-sitemap.blade.php

Add the following code to the sitemap template:

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd"
    @foreach ($data as $item)
            <loc>{{url('/')}}/{{ $item->slug }}</loc>
            <lastmod>{{ $item->updated_at->toAtomString() }}</lastmod>

Making a Sitemap Using Command

After completing all of the preceding steps, try to make a sitemap using the command made in the second step. At the root of the Laravel project, run the following command in cmd.

php artisan sitemap:generate

If the code above runs successfully and there is no error notification, it will make a file called post-sitemap.xml in the folder storage/app/sitemap.

Next we need to make a symlink for the sitemap so that it can be accessed using a URL. The trick is simply to run the command below:

php artisan storage:link

After the symlink has been successfully made, then try to access the sitemap via a browser with the address: domain.com/sitemap/post-sitemap.xml.

Make a Sitemap Automatically

Next is to make a sitemap automatically. The trick is to register the command php artisan sitemap:generate into a cronjob to run periodically as we wish. The method is as follows:

First access SSH then run the command below:

crontab -e

Add the following line of code to the opened cronjob editor

0 0 * * * /usr/local/bin/php /path_laravel/artisan sitemap:generate >> /dev/null 2>&1

Pay attention to the code above there is a section path_laravel which must be replaced according to the laravel project path. The cronjob code above works to run the Sitemap Generator every 12 p.m. every day. So that our sitemap file will always be updated every day.

The last step is to send the sitemap url to the webmaster so that our blog content is indexed immediately.

Simple Experiments – ​​Artificial Loupe


A loupe, also known as a magnifying glass, is a tool used to magnify items that are small and difficult to view with the naked eye. Children will find a loupe fascinating because it allows them to distinguish between genuine objects seen with the naked eye and those seen through a loupe, which will appear larger than the real object.

Simple Experiments; Painting on Milk’s Surface


On a daily basis, milk is one of the most often drank beverages. Milk is high in calcium, which is essential for bone and tooth health. Milk can be used as a weight gainer in particular circumstances. Milk may also be used to make soap and facial masks. However, did you know that we can paint on milk’s surface? Do you want to learn how? Let’s get started!

Simple Experiments; What Foods That Contain Vitamin C?


Superb food is food with a well-balanced nutrient composition. Carbohydrates, protein, fruit, vegetables, and milk should all be included in daily meals. Vitamin C is one of the vitamins required to avoid becoming ill. What foods are high in vitamin C? This experiment can be used to determine the amount of vitamin C in food. Let’s find out!

Simple Experiments; Plants also Perspire

Is it true that plants are living things? Wasn’t he unable to speak and see, never seen to breathe or eat like humans and animals? Simple experiments don’t just cover the fundamentals of chemistry and physics. Simple biology can be introduced to children to drive them to learn about nature and the environment around them, as well as gather knowledge to answer their questions.

Simple Experiments; Balloon Magnet

Magnets are items with the property of induction that can attract other objects. A magnetic field (the area surrounding a magnet) can form naturally or artificially. Natural magnetic fields form as a result of natural events. Because of the composition of specific elements, certain portions of the earth have a magnetic field. Children can learn how to make artificial magnets through simple experiments.

Simple Experiments; Plastic Straw Magnets

Magnets are items that have the ability to alter the objects around them. The magnetic field is the space or region that is affected by the magnetic force around a magnet. Magnets are typically hard objects, however some are relatively soft.

Simple Experiments; Floating Eggs in Water


The ship appears to be able to float on water in numerous photographs. Have you ever seen a genuine ship on the water? Have you ever rode it before? What, in your opinion, makes ships float on water? Is it due to the ship’s modest weight? Let’s try this experiment to see why ships can float in water.

Simple Experiments; Colored Rain In The Water


Have you ever heard of a river flowing through the ocean? What happened to cause the two liquids to flow in opposite directions? Have you ever seen oil spills on water, aside than rivers and the sea? What happened to the oil and water at the moment, exactly? Let’s try this experiment to find out!