Connect with us

WORDPRESS

Top 5 Alternative of Google Blogger in 2022

Published

on

top-5-alternative-of-google-blogger-in-2022-–-h2s-media

Google Blogger also known as Blogspot.com is one of the oldest and popular platforms for blogging and developing basic websites. Google Blogger is dominating the market for decades for creating blogging websites. We all know Blogger is free, easy to set up, easy to operate the backend, and requires no coding knowledge at all to start with.

Blogger was launched as a free platform back in 1999, and even back then it was developed in Python. Initially, it was developed by Pyra Labs, later in 2003 Google acquired it and added the platform as a free add-on service with their Google account. Back in 2006, the UI got redesigned and since then it is receiving regular updates which made Blogger one of the most reliable Blogging platforms even in 2021.

It is available in more than 60 languages and in 2020 they introduced a whole new look for its interface which makes Blogger a considerable choice for any sort of website building. Blogger is web-based hence it is supported on all platforms including Android, Windows, Linux, and macOS.

Why Look For Blogger Alternative

Now the question arises, if Blogger is so awesome, why one should look for alternatives. Because Blogger has many cons which can not be overlooked. Also with the increasing need of users, the website builder platforms need to be flexible and feature-rich enough, so that they can suffice all the developer and user demands. While it comes to Blogger, it has very little amount of extending features, layouts, and designing a versatile homepage using Blogger becomes a challenge. Blogger does not support any third-party apps other than Google services. Also, no customer support is provided for Blogger by Google, so no help from the devs if anything goes wrong.

The purpose for which Google Blogger was developed was writing and blogging only. To make it fast and simple for everyone the Blogger uses a fixed type of layout to showcase the content of the website. There is not much room for either changing the layout to an optimum level or any third-party service integration.

Advertisement

If you want to create different types of pages you might need to create custom CSS, for which you’ll need expertise in HTML and CSS. Else you might have to hire an expensive professional for the job. If you are planning to turn blogging into a career, or you want to start a simple e-commerce site, then Blogger might not be a good enough choice to suffice your needs. Without the ability and versatility to scale, a platform like Blogger should not be a choice for website or blog creation for advanced users.

So, in this article, we would be discussing some other platforms which are good alternatives for Google Blogger users. While looking for Blogger alternatives, you should keep in mind your needs. You should make sure your choice is not only meant to meet the needs of yours, but also stays cost-effective, reliable, easy to use, and provides monetization & customer supports.

So, let’s dive into the list of Blogger alternatives and discuss them in detail.

What are the alternatives to Google Blogger (Blogspot)?

We are going to discuss only the top 5 alternatives for Google Blogger. All the alternatives we are going to talk about are meant for general users with a low or no amount of expertise in coding.

1. Medium

The first one would be Medium without any doubt, as Medium is another platform meant and developed for blogging purposes only. Just like Blogger, Medium is free, and you can post your blogs without paying any subscription fees. If you don’t have any web development or designing skills, don’t worry as Medium comes with its modern layout.

But before you start using Medium, you need to understand that Medium is for posting blogs only. Medium is a lightweight website builder like Google Blogger, but it is actually a closed service where anyone can create an account and post blogs.

Advertisement

Medium Pros:

  • Easy to use with a user-friendly interface
  • Free for everyone
  • Comfortable while reading and writing articles
  • The editor system is very powerful, yet simple and easy to use.
  • Change tracker helps the authors to review changes and edits.
  • Nice statistics page to analyze the performance of the articles
  • As Medium has 96 Domain Authority, and all your articles are posted under the same domain, so by default your on-page SEO gets a boost and gain traction easily.
  • High-stat articles often get featured by the platform itself.
  • You can get noticed as a content writer and can get a chance to earn from writing, so great for newbies.
  • You can earn directly from your blogs by joining the “Medium Partner Program”. If you provide high-quality content the editorial team will recommend it to the subscribed members.
  • Comes with Twitter integration, which might help you to increase your Twitter followers.
  • Embedding media is easy due to the robust editor
  • Has a larger user base, also has a large loyal reader base
  • Categorizing articles is easy, which makes it easier to navigate.

Medium Cons:

  • In order o monetize the blogs you have to join the paid “Medium Partner Program”.
  • The payment wall is complex to understand
  • Your good content might get buried easily under a similar type of contents
  • If you want to get viral with one article or just with one series of articles, it is hard to do so with Medium.
  • A lot of irrelevant and low-quality content can be found on this platform
  • The spam score is 11% with Medium, which is a very big problem in the case of sharing inbound-outbound links and SEO.
  • Topic selection recommendation is poor
  • Not worth serious type of content marketing efforts.

Customer Support

Medium provides premium customer support even if you are not a paid member. You will get support whenever you need it.

Verdict:

Very good for new writers who just want to start writing and learn the basics firsthand. But, getting exposure to new writers is very tough and often impossible.

If you are thinking about becoming a professional blogger or content writer just by posting on medium regularly, that’s not going to happen easily.

If you are a pro blogger and already publishing high-quality articles on other sites, you can use Medium to gain more traction towards your content.

Advertisement

If you are using it for business marketing or content marketing purposes, your goals need to be very clear, as Medium has many limitations.

Of course, the user interface and text editor are the best of their class, even more, robust than most custom and WordPress editors.

Author Rating: 6.5/10

2. WordPress.com

WordPress is a hosted, free, and customizable blogging platform. WordPress is not just a blogging platform, it is a rich website development tool, which provides all the necessary tools and plugins to create a stunning site. Whether you want to create a site for blogging, or e-commerce business, or anything else, WordPress got you covered.

Using WordPress you can do any type of customization, you can modify and edit your website however you want. Even if you are looking for some custom code or CSS that also can be done using with just a few clicks.

If you are fancy about the layout, and front-end design then WordPress is should be your choice. If you don’t have many skills in website building, then also you can use WordPress. Help yourself with some YouTube tutorials, and you will end up creating a stunning website within no time.

Advertisement

While using the WordPress.com service you can use the WordPress.com subdomain for free, if you don’t want to spend on domain registration at the initials stage. The WordPress UI may seem confusing at first, but there is no other web building and blogging tool in the world better than it. It has all the features and the dashboard has the block element development system. WHere you can just drag and drop boxes and blocks, twerk the color, fonts, and voila! your site is ready.

WordPress also comes n the shape of a mobile app on android and iOS devices. If you don’t have access to a PC, you can do all the controls even from your smartphone, from anywhere in the world. All the plugins also come for free, with premium and freemium services included, many of them are completely free to use as well. In the plugin store, you would find multiple plugins for all possible needs you may have in order to create and decorate your website.

The Personal and Premium packages start from $4 and $8, while the monthly business plan costs $25 only. WordPress is not only meant for bloggers, but for all sorts of web builders for any type of small or big business.

WordPress Pros:

  • Over 40% of the websites on the internet around the world are developed using WordPress.
  • The dashboard is very organized and easy to navigate for most of the users.
  • The preview system before you publish content is great.
  • It is fairly simple creating new and duplicate pages and posts
  • Numerous amount plugins are available to provide additional capabilities in the plugin store
  • There are thousands of themes available for free and for low cost, to suit all kinds of needs and businesses.
  • There is a huge generous community behind WordPress
  • For newcomers, there are loads of educational materials available both online for free. Even the documentation is also very comprehensive.
  • Tons of extensions and plugins can be found.
  • The admin interface is very simple but contains almost all the features possible.
  • WordPress is an open-source CMS
  • If you are worried about SEO, using WordPress plugin you can optimize your content and site as you desire
  • If you see any cool features on someone else’s website, just browse the plugin library, find the solution and add it to your website.
  • Very easy to create and keep backup and very easy to update the plugin, WordPress & HTML versions.
  • Cost-effective for bloggers, eCommerce businesses, portfolio sites, and any type of small to large scale business.
  • Very fast to launch the initial design due to the prebuilt themes, database, dashboard, and interactive UI.
  • If you are going to hire a professional for development, then you will find lots of experienced freelancers who can do the job at a very affordable price.
  • You can also self-host sites in WordPress which ensures more control over functionality
  • Cross-team collaboration works very well, where you can design multi-level of access as per the user’s needs.

WordPress Cons:

  • Many unoptimized plugins are available there which can slow down the overall website while loading.
  • Media-like images need to be small to be uploaded and loaded successfully while browsing. Else you can use plugins for that too.
  • The WordPress plugin ecosystem is huge, so it is very common for a new user to become confused due to multiple plugin conflicts.
  • Troubleshooting some plugins are frustrating. Mishappening can lead to the site crashing at loading.
  • Though WordPress is like a complete package, there are some basic features that WordPress doesn’t provide out of the box. Features like auto back-up or one-click back-up are not included, you need to configure plugins for that. No default SEO metrics or tools are provided out of the box.
  • Using lots of plugins without managing the resources properly can increase the JavaScript loads and can slow down the overall website. So while adding new features using 3rd party plugins the developer must know what he is doing.
  • Too many options, features, plugins, and flexibility lead to confusion for many straightforward users.
  • Need a good hosting plan with an ample amount of resources (bandwidth, storage, processing power) for reliable performance.

Customer Support:

WordPress is a community-based service, so you can get a lot of help from community members. Also if you are a premium member, then you can get direct support from the admins. The free version users also can mail for professional-level customer support. Apart from all these, if you are facing any problem with any plugin, most of the plugin admins do have a dedicated customer support team, ready for you.

You can also access the endless amount of video and written content on the net about WordPress and various problems which you might face with it.

Advertisement

Verdict:

If website management is an issue, then WordPress is simply the best. Also good for such users who are planning for upscaling in near future.

WordPress is fairly easy to learn even from newbies from non-technical educational backgrounds.

If you want to become a professional blogger or want to expand in e-commerce shortly, you should always go for WordPress above Google Blogger. In simple words, if you have any business plan regarding your website, just switch to WordPress without any 2nd thought.

Even professional freelancers and website building agencies do suggest WordPress to their clients most of the time.

With time, any digital professional learns new things and starts experimenting with the same in their own business, with WordPress you will have the perfect flexibility to do trials & errors easily.

Advertisement

Author Rating: 9/10

3. Wix

Wix is a great choice for start-ups who are considering a new website to promote their products and services online but don’t have the budget to pay for developers or website creation. Wix also offers free plans and services for users with zero budget.

If you just want to set up a website to determine the viability of your business online, then Wix is a great choice for you. But Wix is also being used by many bloggers around the world. If you work alone and you have to manage all the aspects of your business by yourself, then Wix would be a good choice for you.

Wix is sleek in style, comes with lots of visual features and formatting options. Wix is best if you are looking to create a website for showcasing your products or stores or if you are looking for a portfolio website.

Wix Pros:

  • Wix is a lot easier to navigate and operate, compared to any other web-building tools and CMS.
  • You just have to select the types, and Wix will through hundreds of options towards you for customizations, you just have to pick the one which you like. It is just like operating Microsoft paint and creating a simple drawing.
  • Wis templates are cleaner, fresher, modern, and minimalistic.
  • Wix’s service is reliable. They just don’t disturb the users with new offers and prices, again and again, they respect where you are.
  • Using Wix it is easier to set up metadata, which boosts the SEO. With Wix, you can create functional social media shares and make your lite look more professional to search engines.
  • Even after being a free and simple web builder service, Wix features compatibility with videos, images, and custom buttons. You can even add a countdown timer, target counters, etc, which are pretty awesome for a simple tool like this.
  • Easy to create duplicate pages for similar types of products and services.

Wix Cons:

  • The mobile response of the Wix-made sites is not good. In the present world of smartphones, the lack of mobile device response is a big problem.
  • Speed of page loading is not good, so with less-patient users, the website may lose lots of potential buyers and viewers.
  • Sometimes Wix acts weirdly and becomes resource-heavy on many PCs.
  • The number of templates is limited, may not suffice all types of users.
  • Form collection could have been better for collecting emails
  • The whole Wix development is dependent on the drag and drop system, but still, the dashboard needs a lot of work.
  • Running google ADs on Wix websites is tedious as new AD slots are not easy to define.

Customer Support:

The customer support is good overall good. With premium membership, you can get extended customer supports facilities. Plans range from $14 to $500 per month.

Advertisement

Verdict:

Wix is well-suited for fast and easy results in cost-effective mode. Has some freedom in designs, provides authority and intuitiveness. A simple and reliable tool for simple site development on any niche.

If using Wix for business then it is good for such businesses which don’t need a full-fledged CRM to manage the site. It is a good go-to tool for novice and moderate types of website builders.

Author Rating: 6.5/10

4. Squarespace

Squarespace has a better blogging tool and better support than most competitors. really great for small businesses where the owner or few employees have to do many jobs. Less appropriate for full-blown e-commerce driven websites.

Squarespace provides a very versatile, customizable website building platform that was easy to update with blog posts and to keep a specific look to the overall production website for the social media and promotion department. It’s safe and reliable and offers easy-to-implement and good-looking website templates at a reasonable price.

Advertisement

Squarespace Pros:

  • Security at its best, Suqrespce is known for its security features.
  • Customer support is good
  • Easy for maintenance
  • They have auto-updates so you don’t have to worry about security issues
  • The editor and templates are super easy to use
  • Setup is quick and easy
  • Provides great looking templates
  • Provides good online sessions to develop skills
  • Provides website analytics
  • Image Stacking is reliable
  • Streamlined appearance.
  • Multiple options in all the aspects
  • Space for creativity and ingenuity.
  • Website Building tools are up to the mark
  • Customization is good
  • The sites created in Squarespace are easy for my clients to maintain.
  • Updating a Squarespace site can be completed by the client
  • It is easy for me to quickly design and implement a wide range of websites for most users.

Squarespace Cons:

  • Maintaining a Squarespace website costs more than a traditional or WordPress site.
  • Building larger or more complex sites is difficult.
  • Lack of 3rd party plug-ins reduces customization options.
  • The forum needs to have more users
  • The help center can have more videos
  • Need more templates for more industries
  • Squarespace would be improved by offering options for variants for downloadable products.
  • Low SEO value
  • Hard to expand for larger-scale online catalogs
  • Limited check out integrations
  • Page speed is low, which makes for a poor smartphone experience.
  • WYSIWYG can be difficult to work with – feels like designing in Microsoft Word sometimes.
  • Templates can be limiting and are generally less flexible than competitors like WordPress.
  • Plugins and advanced features are mostly not an option.
  • Trying to configure site options.
  • Adapting a template to a site.
  • Being able to move around the interface.

Customer Support:

Help is offered straight from the back end, and full-sentence searching is used to locate solutions to problems that others may have asked previously. With a plethora of articles and support questions papers, your query is extremely likely to have been addressed.

If not, each page includes the option to send a direct email to support. Each case is assigned a number and can be tracked. Responses are frequently prompt, with links and directions well explained.

Verdict:

Although templates and themes are available, if you are proficient in web programming or web design, you can further modify the site. You can use your custom code to do whatever you want with CSS. One is not bound by a template or theme.

Squarespace, in my opinion, is the finest option if all you need is a basic informational website. I’ve used WordPress before, and you have to continuously update it and the plugins due to security concerns. Squarespace is really simple to use. It contains useful templates to work from, and the design and building process is simple. They’ve done an excellent job of creating a platform for those who aren’t web developers.

Advertisement

Author Rating: 7.5/10

5. Tumblr

Tumblr is a great place to share technology and other news. When I worked on a new technology component, I could simply write an article and put it on Tumblr, where anyone could read it and learn from it. This makes it incredibly simple to share with everyone.

It’s ideal for outspoken bloggers that enjoy posting interactive content. Experts can also utilize this platform to highlight their best work and convert their blog into a portfolio.

Your blog’s appearance is also editable. Simply select a free or premium theme from the library and customize it to your preferences. Keep in mind that depending on the theme, there may be restrictions on how much you can alter.

Tumblr is ideal for sharing media and short-form content with a liberal, teen, or young adult audience. It is, however, unsuitable for B2B marketing. In addition, if editorial control over comments and answers is crucial, another platform may be preferable. If your target market is center-right or conservative, you’ll probably have more luck elsewhere.

Tumblr Pros:

Advertisement
  • The display of structured data
  • Providing a variety of formatting tools
  • Template selection
  • Simple, user-friendly microblogging platform.
  • Your stuff is simple to follow and share.
  • A wide range of content is available for people to link to and respond to.
  • Tumblr’s demographics may be ideal for some businesses.
  • We see a higher rate of engagement with content uploaded on Tumblr compared to other prominent social media platforms.
  • It’s really simple to grow a Tumblr following.
  • Tumblr is easily accessible as a cell phone download.
  • It is completely free to use.
  • It enables employees who might not otherwise have the opportunity to express themselves creatively at work to do so for the benefit of your company.

Tumblr Cons:

  • The layout of the page cannot be completely changed.
  • Display formats must be selected from the templates.
  • There are no sorting options available.
  • Improved filters to limit offensive or unsuitable work content.
  • More ways to respond to postings.
  • More robust privacy choices to accommodate a broader range of users and demands.
  • The search function might be improved to be more powerful and thorough.
  • Although I prefer the randomized aesthetic layout of samples, several team members found it irritating.
  • I rarely understand the “recommended for you” option…
  • Tumblr may improve by giving users additional options for customizing their posts.
  • It cannot be used in place of other social media sites such as Facebook and Twitter.
  • Google Images and Facebook both assist users in improving their photos by displaying filter choices or auto-toning.
  • Tumblr currently lacks this feature, which would be a fantastic addition.

Customer Support:

Customer support is good, all you have to do is mail your quarry to [email protected], and your problem will be answered within 48 hours. You can also use the “contact form” on the Tumblr homepage, to get in touch with the support team.

Verdict:

Feel free to make your own design if you know HTML and CSS. There is a developer center as well as forum sections where you may get platform documentation and participate in conversations.

Tumblr may be an excellent tool for retail businesses. At our company, we’ve discovered that it’s a terrific approach to display new items and attract more younger people to our store. Depending on the type of products you want to display your followers, you should do testing with various types of effects that show the product that you are offering in a way that your clients are more likely to find appealing.

Personal blogging is probably the best use of this website, but I’ve also seen it utilized as a dev blog service for games and films, or as a storefront for crafters. The ability to create timelines for future postings and share photographs, text, videos, and other media makes it excellent for people who need to post products and link to external stores for purchasing. The tagging options and universal ability to share personal stuff make it ideal for fanbases/fan art and similar communities.

Author Rating: 7/10

Advertisement

Wrapping Up

While choosing the best blogging and web-building platform for yourself, your decision depends on your needs. Evaluate your needs, plans, and scaling opportunities before you start working with any of the above alternatives.

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

WORDPRESS

[GET] The7 Website And Ecommerce Builder For WordPress

Published

on

By

The7 website and ecommerce builder for wordpress is the most customizable WordPress, Elementor, and WooCommerce theme available on the market up to …

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

WORDPRESS

Making 43% of the Web More Dynamic with the WordPress Interactivity API – WordPress.com News

Published

on

By

Making 43% of the Web More Dynamic with the WordPress Interactivity API – WordPress.com News

Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.

But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance. 

Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core. 

The Interactivity API started as an experimental plugin in early 2022, became an official proposal in March 2023, and was finally merged into WordPress core with the release of WordPress 6.5 on April 2, 2024. It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.

ELI5: The Interactivity API and the Image Block

Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The Image block, in particular, is a great way to show off the Interactivity API in action. 

Advertisement

At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, the Interactivity API launches a lightbox showing a high-resolution version of the image.

The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the wp-on--click directive to the image element, referencing the showLightbox action in view.js.

You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work here in the store object.

actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {
					return;
				}

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.
				callbacks.setOverlayStyles();
			},
...

The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.

This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.

With the Interactivity API, developers have a predictable way to provide interactivity to users on the front-end. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries are included.

Advertisement

How is the Interactivity API different from Alpine, React, or Vue?

Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?

At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.

Mario Santos, a developer on the WordPress core team, wrote in the Interactivity API proposal that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”

The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.

For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.

Five goals shaped the core development team’s decisions as they built the API: 

Advertisement
  1. Block-first and PHP-first: Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.
  2. Backward-compatible: Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.
  3. Declarative and reactive: Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.
  4. Performant: Optimizing runtime performance to deliver a fast and lightweight user experience.
  5. Send less JavaScript: Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.  So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.

Other goals are on the horizon, including improvements to client-side navigation, as you can see in this PR.

Interactivity API vs. Alpine

The Interactivity API shares a few similarities to Alpine—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and Laravel projects.

Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. Unlike Alpine, the Interactivity API is designed to seamlessly integrate with WordPress and support server-side rendering of its directives.

With the interactivity API, you can easily generate the view from the server in PHP, and then add client-side interactivity. This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers. 

So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.

Interactivity API vs. React and Vue

Many developers have opted for React when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.

Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”

Advertisement

Part of the goal in developing the Interactivity API was the need to write as little as little JavaScript as possible, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.

The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and Vue to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.

For these reasons, among others, the core team preferred Preact—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.

Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it in this comment on the original proposal.

Preact only loads if the page source contains an interactive block, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping no JavaScript as a default).

In the original Interactivity API proposal, you can see the run-down and comparison of several frameworks and why Preact was chosen over the others.

Advertisement

What does the new Interactivity API provide to WordPress developers?

In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.

Graphic from Proposal: The Interactivity API – A better developer experience in building interactive blocks on WordPress.org

Directives

Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference lists all the available directives.

These directives are typically added in the block’s render.php file, and they support all of the WordPress APIs, including actions, filters, and core translation APIs. 

Here’s the render file of a sample block. Notice the click event (data-wp-on--click="actions.toggle"), and how we bind the value of the aria-expanded attributes via directives.

<div
	<?php echo get_block_wrapper_attributes(); ?>
	data-wp-interactive="create-block"
	<?php echo wp_interactivity_data_wp_context( array( 'isOpen' => false ) ); ?>
	data-wp-watch="callbacks.logIsOpen"
>
	<button
		data-wp-on--click="actions.toggle"
		data-wp-bind--aria-expanded="context.isOpen"
		aria-controls="<?php echo esc_attr( $unique_id ); ?>"
	>
		<?php esc_html_e( 'Toggle', 'my-interactive-block' ); ?>
	</button>

	<p
		id="<?php echo esc_attr( $unique_id ); ?>"
		data-wp-bind--hidden="!context.isOpen"
	>
		<?php
			esc_html_e( 'My Interactive Block - hello from an interactive block!', 'my-interactive-block' );
		?>
	</p>
</div>

Do you need to dynamically update an element’s inner text? The Interactivity API allows you to use data-wp-text on an element, just like you can use v-text in Vue.

You can bind a value to a boolean or string using wp-bind– or hook up a click event by using data-wp-on–click on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.

Advertisement

Handling state, side effects, and actions

The second stage of adding interactivity is to create a store, which is usually done in your view.js file. In the store, you’ll have access to the same context as in your render.php file.

In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.

import { store, getContext } from '@wordpress/interactivity';

store( 'create-block', {
	actions: {
		toggle: () => {
			const context = getContext();
			context.isOpen = ! context.isOpen;
		},
	},
	callbacks: {
		logIsOpen: () => {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
		},
	},
} );

Try it out for yourself

The Interactivity API is production-ready and already running on WordPress.com! With any WordPress.com plan, you’ll have access to the core blocks built on top of the Interactivity API. 

If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:

npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 

This will give you an example interactive block, with directives and state handling set up. 

You can then play around with this locally, using wp-env, using a staging site, or by uploading the plugin directly to your site running a plugin-eligible WordPress.com plan

Advertisement

If you want a seamless experience between your local dev setup and your WordPress.com site, try using it with our new GitHub Deployments feature! Developing custom blocks is the perfect use case for this new tool.

The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:


Join 106.9M other subscribers

Source link

Advertisement
Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

WORDPRESS

The Masters Golf Tournament – WordPress.com News

Published

on

By

The Masters Golf Tournament – WordPress.com News

What’s harder: winning the Masters Tournament or re-creating its website in under 30 minutes? Watch the video and find out.

Congratulations are in order for Scottie Scheffler, the winner of the 2024 Masters Tournament in Augusta, Georgia! In today’s Build and Beyond video, Jamie Marsland takes on the slightly less intimidating task of re-creating the Masters website as quickly as he can. Can he possibly do it in just 30 minutes?

Along the way, you’ll learn about sticky navigation menus, image overflows and breakouts, card layouts, and more.

Interested in a free trial that allows you to test our all that WordPress.com has to offer? Click below:


Join 110M other subscribers

Advertisement

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

Trending

Follow by Email
RSS