#disable xmlrpc in wordpress
Explore tagged Tumblr posts
Text
Enhance your WordPress website's security by disabling XML-RPC. Learn to secure your website with this step-by-step guide.
#disable xmlrpc in wordpress#wordpress xmlrpc disable#disable xml-rpc-api#disable xmlrpc#how to disable xml-rpc in wordpress
0 notes
Text
Quick Nginx block xmlrpc.php
Go to your Nginx configuration for the WordPress domain and add the following block in the server section : location = /xmlrpc.php { deny all; access_log off; log_not_found off; } The above will: Deny access to xmlrpc.php , Disable access logging for xmlrpc access ( optional – you can comment out this line), Avoids logging a “404 Not Found” if access is denied ( optional – you can comment…
0 notes
Text
How to Check If Your Website or Plugins Are Using XML-RPC

How to Check If Your Website or Plugins Are Using XML-RPC | https://tinyurl.com/2cmcveav | #Blogging #security #Wordpress #XMLRPC If you’re managing a WordPress site and want to know whether xmlrpc.php is being actively used by your site or plugins, you’ll need to perform some advanced steps. Disabling xmlrpc.php can improve security, but it’s essential to ensure that this won’t break any functionality. Here’s how you can determine if XML-RPC is in use on your site. Monitoring Server Logs for XML-RPC Requests One of the most direct ways to check if your site is using xmlrpc.php is by monitoring your server’s access logs. Steps to Monitor Server Logs What to Look For Using Plugins to Log XML-RPC Requests WordPress […] Read more... https://tinyurl.com/2cmcveav
0 notes
Link
What Is xmlrpc.php in WordPress and Why You Should Disable It
If you’re a WordPress enthusiast focused on safeguarding your website’s security, chances are you’ve encountered the term “xmlrpc.php.” In this article, we’ll delve into the essence of xmlrpc.php, its functions, and the rationale behind potentially disabling it to bolster the security of your WordPress site...
Learn more here:
https://www.nilebits.com/blog/2023/10/what-is-xmlrpc-php-in-wordpress-and-why-you-should-disable-it/
0 notes
Link
0 notes
Video
youtube
How To Disable WordPress XML RPC To Enhance Your Site Security? Easy Method Tutorial 🔒 https://www.youtube.com/watch?v=5ABRHVYVc5E 🛟🎯🎬 #Security #Disable #WordPress #XMLRPC
0 notes
Text
This guide is intended to help you install and host your WordPress website using Caddy Web server. Caddy is an open-source, production-ready that is build to be fast, easy to use, and makes you more productive. Caddy is available for Windows, Mac, Linux, BSD, Solaris, and Android. You can also use some of the popular WordPress hosting platforms for your website hosting needs. If you don’t have Caddy Web server installed, use our guide Install Caddy web server on an Ubuntu 18.04 with Let’s Encrypt SSL to set it up. For Nginx users, see How to Setup WordPress Multisite Network with Nginx and Let’s Encrypt Once you have Caddy web server up and running, proceed to configure it for WordPress hosting: Using Caddy Web Server to host WordPress Website In this section, we will install and configure WordPress to be powered by Caddy web server. To run a WordPress website, you need PHP, Web server, and Database server sudo apt -y update sudo apt -y install php-fpm php-mysql php-curl php-gd php-mbstring php-common php-xml php-xmlrpc For CentOS 7 server run: sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum install epel-release sudo yum install yum-utils sudo yum-config-manager --disable remi-php54 sudo yum-config-manager --enable remi-php72 sudo yum -y install php-cli php-fpm php-mysql php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath Install and Configure MariaDB Database server Install and configure MariaDB database server using: Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7 Once done, login as root user and create a database for WordPress $ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 520 Server version: 10.3.9-MariaDB-1:10.3.9+maria~bionic-log mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE wp_site; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON wp_site.* to 'wp_user'@'localhost' IDENTIFIED BY 'StrongPassword'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> quit Bye Download WordPress and Install Now download WordPress and untar the archive wget http://wordpress.org/latest.tar.gz tar xvf latest.tar.gz This will extract all content of the tarball to a folder named wordpress on your working directory. Move the wordpress folder to /var/www directory sudo mv wordpress /var/www Change ownership permissions to userwww-data and group. sudo chown -R www-data:www-data /var/www/wordpress Configure WordPress database connection mv /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php Edit the file to configure sudo vim /var/www/wordpress/wp-config.php Set below variables // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wp_site'); /** MySQL database username */ define('DB_USER', 'wp_user'); /** MySQL database password */ define('DB_PASSWORD', 'StrongPassword'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); Configuring Caddy to Serve the WordPress Site We have WordPress installation ready, we now need to configure Caddy Web server to serve our WordPress website. Start by creating a Caddy configuration file on /etc/caddy/Caddyfile sudo vim /etc/caddy/Caddyfile Add the content example.com tls [email protected] root /var/www/wordpress gzip fastcgi / /run/php/php7.2-fpm.sock php rewrite if path not_match ^\/wp-admin
to path path/ /index.php?query Replace example.com with your actual domain for WordPress website and [email protected] with an actual email address used to request Let’s Encrypt certificate. We’re using php-fpm via fastcgi to support php. Start caddy service sudo systemctl start caddy.service If the start was successful, you should get a successful message: # systemctl status caddy ● caddy.service - Caddy HTTP/2 web server Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2018-09-02 14:34:26 EAT; 7s ago Docs: https://caddyserver.com/docs Main PID: 32443 (caddy) Tasks: 12 (limit: 4704) CGroup: /system.slice/caddy.service └─32443 /usr/local/bin/caddy -log /var/log/caddy.log -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp Sep 02 14:34:26 wp.computingpost.com systemd[1]: Started Caddy HTTP/2 web server. Sep 02 14:34:34 wp.computingpost.com caddy[32443]: Activating privacy features... done. Sep 02 14:34:34 wp.computingpost.com caddy[32443]: https://wp.computingpost.com Sep 02 14:34:34 wp.computingpost.com caddy[32443]: //wp.computingpost.com Access the WordPress dashboard by visiting.https://example.com You should get initial wordpress setup page. Provider username and password. Thank you for reading our guide on how to Install Caddy web server on an Ubuntu 18.04 with Let’s Encrypt SSL. I like Caddy simplicity, robustness and the fact that it uses HTTPS by default. No routing and redirects needed to host your website.
0 notes
Photo

I will remove malware,fix redirecting issue and blacklist removal
https://www.fiverr.com/a1webservice/remove-malware-fix-redirecting-issue-and-blacklist-removal
I will Fix your hacked WordPress site or hacked WordPress blog and secure within 4-8 hours and up to 24 hours.I will clean/delete or remove Malware or any obfuscated or Malicious code from your WordPress website.Cleaned 1k+ WordPress hacked websites offline and online till now GOT HACKED?✔️ Infected with Malware✔️ Google Adwords Ads Disapproved as Malware infected✔️ Suspended by Hosting Company✔️ Redirecting to Spam Website✔️ Blacklisted by Go0gle✔️ Google search engine Showing Japanese keywords FIXING HACKED AND REMOVE MALWARE:✔️ Vulnerability Testing & Remove Malware✔️ Fix Malicious/spam Redirecting or popups✔️ Fix Phishing notice✔️ Remove"This site may be hacked" Message from go0gle search engine✔️ Fixing the Japanese keyword hack issue Google Adwords Remove Malware =>>$120+ What Type off Security I Will Do:✔️ User Accounts Security✔️ User Login Security✔️ Protect htaccess file✔️ Protect wp-config.php file✔️ Disable PHP Shell or Backdoor execution✔️ Restrict Direct Access to Plugin and Theme PHP files✔️ Protect Website from SQL Injection✔️ Block WordPress XMLRPC Requests✔️ Protect XSS Attack Note: Before placing an order contact me for making an effective Deal
#remove malware#malware#wordpress malware#hacked wordpress#malware removal#security#virus#virus removal#hacked virus
0 notes
Text
Jumping Into Webmentions With NextJS (or Not)
Webmention is a W3C recommendation last published on January 12, 2017. And what exactly is a Webmention? It’s described as…
[…] a simple way to notify any URL when you mention it on your site. From the receiver’s perspective, it’s a way to request notifications when other sites mention it.
In a nutshell, it’s a way of letting a website know it has been mentioned somewhere, by someone, in some way. The Webmention spec also describes it as a way for a website to let others know it cited them. What that basically bails down to is that your website is an active social media channel, channeling communication from other channels (e.g. Twitter, Instagram, Mastodon, Facebook, etc.).
How does a site implement Webmentions? In some cases, like WordPress, it’s as trivial as installing a couple of plugins. Other cases may not be quite so simple, but it’s still pretty straightforward. In fact, let’s do that now!
Here’s our plan
Declare an endpoint to receive Webmentions
Process social media interactions to Webmentions
Get those mentions into a website/app
Set the outbound Webmentions
Luckily for us, there are services in place that make things extremely simple. Well, except that third point, but hey, it’s not so bad and I’ll walk through how I did it on my own atila.io site.
My site is a server-side blog that’s pre-rendered and written with NextJS. I have opted to make Webmention requests client-side; therefore, it will work easily in any other React app and with very little refactoring in any other JavaScript application.
Step 1: Declare an endpoint to receive Webmentions
In order to have an endpoint we can use to accept Webmentions, we need to either write the script and add to our own server, or use a service such as Webmention.io (which is what I did).
Webmention.io is free and you only need to confirm ownership over the domain you register. Verification can happen a number of ways. I did it by adding a rel="me" attribute to a link in my website to my social media profiles. It only takes one such link, but I went ahead and did it for all of my accounts.
<a href="https://twitter.com/atilafassina" target="_blank" rel="me noopener noreferrer" > @AtilaFassina </a>
Verifying this way, we also need to make sure there’s a link pointing back to our website in that Twitter profile. Once we’ve done that, we can head back to Webmention.io and add the URL.
This gives us an endpoint for accepting Webmentions! All we need to do now is wire it up as <link> tags in the <head> of our webpages in order to collect those mentions.
<head> <link rel="webmention" href="https://webmention.io/{user}/webmention" /> <link rel="pingback" href="https://webmention.io/{user}/xmlrpc" /> <!-- ... --> </head>
Remember to replace {user} with your Webmention.io username.
Step 2: Process social media interactions into Webmentions
We are ready for the Webmentions to start flowing! But wait, we have a slight problem: nobody actually uses them. I mean, I do, you do, Max Böck does, Swyx does, and… that’s about it. So, now we need to start converting all those juicy social media interactions into Webmentions.
And guess what? There’s an awesome free service for it. Fair warning though: you’d better start loving the IndieWeb because we’re about to get all up in it.
Bridgy connects all our syndicated content and converts them into proper Webmentions so we can consume it. With a SSO, we can get each of our profiles lined up, one by one.
Step 3: Get those mentions into a website/app
Now it’s our turn to do some heavy lifting. Sure, third-party services can handle all our data, but it’s still up to us to use it and display it.
We’re going to break this up into a few stages. First, we’ll get the number of Webmentions. From there, we’ll fetch the mentions themselves. Then we’ll hook that data up to NextJS (but you don’t have to), and display it.
Get the number of mentions
type TMentionsCountResponse = { count: number type: { like: number mention: number reply: number repost: number } }
That is an example of an object we get back from the Webmention.io endpoint. I formatted the response a bit to better suit our needs. I’ll walk through how I did that in just a bit, but here’s the object we will get:
type TMentionsCount = { mentions: number likes: number total: number }
The endpoint is located at:
https://webmention.io/api/count.json?target=${post_url}
The request will not fail without it, but the data won’t come either. Both Max Böck and Swyx combine likes with reposts and mentions with replies. In Twitter, they are analogous.
const getMentionsCount = async (postURL: string): TMentionsCount => { const resp = await fetch( `https://webmention.io/api/count.json?target=${postURL}/` ) const { type, count } = await resp.json()
return { likes: type.like + type.repost, mentions: type.mention + type.reply, total: count, } }
Get the actual mentions
Before getting to the response, please note that the response is paginated, where the endpoint accepts three parameters in the query:
page: the page being requested
per-page: the number of mentions to display on the page
target: the URL where Webmentions are being fetched
Once we hit https://webmention.io/api/mentions and pass the these params, the successful response will be an object with a single key links which is an array of mentions matching the type below:
type TMention = { source: string verified: boolean verified_date: string // date string id: number private: boolean data: { author: { name: string url: string photo: string // url, hosted in webmention.io } url: string name: string content: string // encoded HTML published: string // date string published_ts: number // ms } activity: { type: 'link' | 'reply' | 'repost' | 'like' sentence: string // pure text, shortened sentence_html: string // encoded html } target: string }
The above data is more than enough to show a comment-like section list on our site. Here’s how the fetch request looks in TypeScript:
const getMentions = async ( page: string, postsPerPage: number, postURL: string ): { links: TWebMention[] } => { const resp = await fetch( `https://webmention.io/api/mentions?page=${page}&per-page=${postsPerPage}&target=${postURL}` ) const list = await resp.json() return list.links }
Hook it all up in NextJS
We’re going to work in NextJS for a moment. It’s all good if you aren’t using NextJS or even have a web app. We already have all the data, so those of you not working in NextJS can simply move ahead to Step 4. The rest of us will meet you there.
As of version 9.3.0, NextJS has three different methods for fetching data:
getStaticProps: fetches data on build time
getStaticPaths: specifies dynamic routes to pre-render based on the fetched data
getServerSideProps: fetches data on each request
Now is the moment to decide at which point we will be making the first request for fetching mentions. We can pre-render the data on the server with the first batch of mentions, or we can make the entire thing client-side. I opted to go client-side.
If you’re going client-side as well, I recommend using SWR. It’s a custom hook built by the Vercel team that provides good caching, error and loading states — it and even supports React.Suspense.
Display the Webmention count
Many blogs show the number of comments on a post in two places: at the top of a blog post (like this one) and at the bottom, right above a list of comments. Let’s follow that same pattern for Webmentions.
First off, let’s create a component for the count:
const MentionsCounter = ({ postUrl }) => { const { t } = useTranslation() // Setting a default value for `data` because I don't want a loading state // otherwise you could set: if(!data) return <div>loading...</div> const { data = {}, error } = useSWR(postUrl, getMentionsCount)
if (error) { return <ErrorMessage>{t('common:errorWebmentions')}</ErrorMessage> }
// The default values cover the loading state const { likes = '-', mentions = '-' } = data
return ( <MentionCounter> <li> <Heart title="Likes" /> <CounterData>{Number.isNaN(likes) ? 0 : likes}</CounterData> </li> <li> <Comment title="Mentions" />{' '} <CounterData>{Number.isNaN(mentions) ? 0 : mentions}</CounterData> </li> </MentionCounter> ) }
Thanks to SWR, even though we are using two instances of the WebmentionsCounter component, only one request is made and they both profit from the same cache.
Feel free to peek at my source code to see what’s happening:
WebmentionsCounter (the component)
getMentionsCount (the helper function)
Post layout component (where we’re using the component)
Display the mentions
Now that we have placed the component, it’s time to get all that social juice flowing!
At of the time of this writing, useSWRpages is not documented. Add to that the fact that the webmention.io endpoint doesn’t offer collection information on a response (i.e. no offset or total number of pages), I couldn’t find a way to use SWR here.
So, my current implementation uses a state to keep the current page stored, another state to handle the mentions array, and useEffect to handle the request. The “Load More” button is disabled once the last request brings back an empty array.
const Webmentions = ({ postUrl }) => { const { t } = useTranslation() const [page, setPage] = useState(0) const [mentions, addMentions] = useState([])
useEffect(() => { const fetchMentions = async () => { const olderMentions = await getMentions(page, 50, postUrl) addMentions((mentions) => [...mentions, ...olderMentions]) } fetchMentions() }, [page])
return ( <> {mentions.map((mention, index) => ( <Mention key={mention.data.author.name + index}> <AuthorAvatar src={mention.data.author.photo} lazy /> <MentionContent> <MentionText data={mention.data} activity={mention.activity.type} /> </MentionContent> </Mention> ))} </MentionList> {mentions.length > 0 && ( <MoreButton type="button" onClick={() => { setPage(page + 1) }} > {t('common:more')} </MoreButton> )} </> ) }
The code is simplified to allow focus on the subject of this article. Again, feel free to peek at the full implementation:
Webmention component
getMentions helper
Posts layout component
Step 4: Handling outbound mentions
Thanks to Remy Sharp, handling outbound mentions from one website to others is quite easy and provides an option for each use case or preference possible.
The quickest and easiest way is to head over to Webmention.app, get an API token, and set up a web hook. Now, if you have RSS feed in place, the same thing is just as easy with an IFTT applet, or even a deploy hook.
If you prefer to avoid using yet another third-party service for this feature (which I totally get), Remy has open-sourced a CLI package called wm which can be ran as a postbuild script.
But that’s not enough to handle outbound mentions. In order for our mentions to include more than simply the originating URL, we need to add microformats to our information. Microformats are key because it’s a standardized way for sites to distribute content in a way that Webmention-enabled sites can consume.
At their most basic, microformats are a kind of class-based notations in markup that provide extra semantic meaning to each piece. In the case of a blog post, we will use two kinds of microformats:
h-entry: the post entry
h-card: the author of the post
Most of the required information for h-entry is usually in the header of the page, so the header component may end up looking something like this:
<header class="h-entry"> <!-- the post date and time --> <time datetime="2020-04-22T00:00:00.000Z" class="dt-published"> 2020-04-22 </time> <!-- the post title --> <h1 class="p-name"> Webmentions with NextJS </h1> </header>
And that’s it. If you’re writing in JSX, remember to replace class with className, that datetime is camelCase (dateTime), and that you can use the new Date('2020-04-22').toISOString() function.
It’s pretty similar for h-card. In most cases (like mine), author information is below the article. Here’s how my page’s footer looks:
<footer class="h-card"> <!-- the author name --> <span class="p-author">Atila Fassina</span> <!-- the authot image--> <img alt="Author’s photograph: Atila Fassina" class="u-photo" src="/images/internal-avatar.jpg" lazy /> </footer>
Now, whenever we send an outbound mention from this blog post, it will display the full information to whomever is receiving it.
Wrapping up
I hope this post has helped you getting to know more about Webmentions (or even about IndieWeb as a whole), and perhaps even helped you add this feature to your own website or app. If it did, please consider sharing this post to your network. I will be super grateful!
References
Using Web Mentions on Static Sites (Max Böck)
Client-side Webmentions (Swyx)
Send outgoing Webmentions (Remy Sharp)
Your first webmention (Aaron Parecki)
Further reading
Webmention W3C Specification (Recommendation)
Webmention.io
Webmention.App
Outbound WebMentions CLI
Bridgy
Microformats.org
IndieWeb
The post Jumping Into Webmentions With NextJS (or Not) appeared first on CSS-Tricks.
source https://css-tricks.com/jumping-into-webmentions-with-nextjs-or-not/
from WordPress https://ift.tt/3dt9uOY via IFTTT
0 notes
Text
Jumping Into Webmentions With NextJS (or Not)
Webmention is a W3C recommendation last published on January 12, 2017. And what exactly is a Webmention? It’s described as…
[…] a simple way to notify any URL when you mention it on your site. From the receiver’s perspective, it’s a way to request notifications when other sites mention it.
In a nutshell, it’s a way of letting a website know it has been mentioned somewhere, by someone, in some way. The Webmention spec also describes it as a way for a website to let others know it cited them. What that basically bails down to is that your website is an active social media channel, channeling communication from other channels (e.g. Twitter, Instagram, Mastodon, Facebook, etc.).
How does a site implement Webmentions? In some cases, like WordPress, it’s as trivial as installing a couple of plugins. Other cases may not be quite so simple, but it’s still pretty straightforward. In fact, let’s do that now!
Here’s our plan
Declare an endpoint to receive Webmentions
Process social media interactions to Webmentions
Get those mentions into a website/app
Set the outbound Webmentions
Luckily for us, there are services in place that make things extremely simple. Well, except that third point, but hey, it’s not so bad and I’ll walk through how I did it on my own atila.io site.
My site is a server-side blog that’s pre-rendered and written with NextJS. I have opted to make Webmention requests client-side; therefore, it will work easily in any other React app and with very little refactoring in any other JavaScript application.
Step 1: Declare an endpoint to receive Webmentions
In order to have an endpoint we can use to accept Webmentions, we need to either write the script and add to our own server, or use a service such as Webmention.io (which is what I did).
Webmention.io is free and you only need to confirm ownership over the domain you register. Verification can happen a number of ways. I did it by adding a rel="me" attribute to a link in my website to my social media profiles. It only takes one such link, but I went ahead and did it for all of my accounts.
<a href="https://twitter.com/atilafassina" target="_blank" rel="me noopener noreferrer" > @AtilaFassina </a>
Verifying this way, we also need to make sure there’s a link pointing back to our website in that Twitter profile. Once we’ve done that, we can head back to Webmention.io and add the URL.
This gives us an endpoint for accepting Webmentions! All we need to do now is wire it up as <link> tags in the <head> of our webpages in order to collect those mentions.
<head> <link rel="webmention" href="https://webmention.io/{user}/webmention" /> <link rel="pingback" href="https://webmention.io/{user}/xmlrpc" /> <!-- ... --> </head>
Remember to replace {user} with your Webmention.io username.
Step 2: Process social media interactions into Webmentions
We are ready for the Webmentions to start flowing! But wait, we have a slight problem: nobody actually uses them. I mean, I do, you do, Max Böck does, Swyx does, and… that’s about it. So, now we need to start converting all those juicy social media interactions into Webmentions.
And guess what? There’s an awesome free service for it. Fair warning though: you’d better start loving the IndieWeb because we’re about to get all up in it.
Bridgy connects all our syndicated content and converts them into proper Webmentions so we can consume it. With a SSO, we can get each of our profiles lined up, one by one.
Step 3: Get those mentions into a website/app
Now it’s our turn to do some heavy lifting. Sure, third-party services can handle all our data, but it’s still up to us to use it and display it.
We’re going to break this up into a few stages. First, we’ll get the number of Webmentions. From there, we’ll fetch the mentions themselves. Then we’ll hook that data up to NextJS (but you don’t have to), and display it.
Get the number of mentions
type TMentionsCountResponse = { count: number type: { like: number mention: number reply: number repost: number } }
That is an example of an object we get back from the Webmention.io endpoint. I formatted the response a bit to better suit our needs. I’ll walk through how I did that in just a bit, but here’s the object we will get:
type TMentionsCount = { mentions: number likes: number total: number }
The endpoint is located at:
https://webmention.io/api/count.json?target=${post_url}
The request will not fail without it, but the data won’t come either. Both Max Böck and Swyx combine likes with reposts and mentions with replies. In Twitter, they are analogous.
const getMentionsCount = async (postURL: string): TMentionsCount => { const resp = await fetch( `https://webmention.io/api/count.json?target=${postURL}/` ) const { type, count } = await resp.json()
return { likes: type.like + type.repost, mentions: type.mention + type.reply, total: count, } }
Get the actual mentions
Before getting to the response, please note that the response is paginated, where the endpoint accepts three parameters in the query:
page: the page being requested
per-page: the number of mentions to display on the page
target: the URL where Webmentions are being fetched
Once we hit https://webmention.io/api/mentions and pass the these params, the successful response will be an object with a single key links which is an array of mentions matching the type below:
type TMention = { source: string verified: boolean verified_date: string // date string id: number private: boolean data: { author: { name: string url: string photo: string // url, hosted in webmention.io } url: string name: string content: string // encoded HTML published: string // date string published_ts: number // ms } activity: { type: 'link' | 'reply' | 'repost' | 'like' sentence: string // pure text, shortened sentence_html: string // encoded html } target: string }
The above data is more than enough to show a comment-like section list on our site. Here’s how the fetch request looks in TypeScript:
const getMentions = async ( page: string, postsPerPage: number, postURL: string ): { links: TWebMention[] } => { const resp = await fetch( `https://webmention.io/api/mentions?page=${page}&per-page=${postsPerPage}&target=${postURL}` ) const list = await resp.json() return list.links }
Hook it all up in NextJS
We’re going to work in NextJS for a moment. It’s all good if you aren’t using NextJS or even have a web app. We already have all the data, so those of you not working in NextJS can simply move ahead to Step 4. The rest of us will meet you there.
As of version 9.3.0, NextJS has three different methods for fetching data:
getStaticProps: fetches data on build time
getStaticPaths: specifies dynamic routes to pre-render based on the fetched data
getServerSideProps: fetches data on each request
Now is the moment to decide at which point we will be making the first request for fetching mentions. We can pre-render the data on the server with the first batch of mentions, or we can make the entire thing client-side. I opted to go client-side.
If you’re going client-side as well, I recommend using SWR. It’s a custom hook built by the Vercel team that provides good caching, error and loading states — it and even supports React.Suspense.
Display the Webmention count
Many blogs show the number of comments on a post in two places: at the top of a blog post (like this one) and at the bottom, right above a list of comments. Let’s follow that same pattern for Webmentions.
First off, let’s create a component for the count:
const MentionsCounter = ({ postUrl }) => { const { t } = useTranslation() // Setting a default value for `data` because I don't want a loading state // otherwise you could set: if(!data) return <div>loading...</div> const { data = {}, error } = useSWR(postUrl, getMentionsCount)
if (error) { return <ErrorMessage>{t('common:errorWebmentions')}</ErrorMessage> }
// The default values cover the loading state const { likes = '-', mentions = '-' } = data
return ( <MentionCounter> <li> <Heart title="Likes" /> <CounterData>{Number.isNaN(likes) ? 0 : likes}</CounterData> </li> <li> <Comment title="Mentions" />{' '} <CounterData>{Number.isNaN(mentions) ? 0 : mentions}</CounterData> </li> </MentionCounter> ) }
Thanks to SWR, even though we are using two instances of the WebmentionsCounter component, only one request is made and they both profit from the same cache.
Feel free to peek at my source code to see what’s happening:
WebmentionsCounter (the component)
getMentionsCount (the helper function)
Post layout component (where we’re using the component)
Display the mentions
Now that we have placed the component, it’s time to get all that social juice flowing!
At of the time of this writing, useSWRpages is not documented. Add to that the fact that the webmention.io endpoint doesn’t offer collection information on a response (i.e. no offset or total number of pages), I couldn’t find a way to use SWR here.
So, my current implementation uses a state to keep the current page stored, another state to handle the mentions array, and useEffect to handle the request. The “Load More” button is disabled once the last request brings back an empty array.
const Webmentions = ({ postUrl }) => { const { t } = useTranslation() const [page, setPage] = useState(0) const [mentions, addMentions] = useState([])
useEffect(() => { const fetchMentions = async () => { const olderMentions = await getMentions(page, 50, postUrl) addMentions((mentions) => [...mentions, ...olderMentions]) } fetchMentions() }, [page])
return ( <> {mentions.map((mention, index) => ( <Mention key={mention.data.author.name + index}> <AuthorAvatar src={mention.data.author.photo} lazy /> <MentionContent> <MentionText data={mention.data} activity={mention.activity.type} /> </MentionContent> </Mention> ))} </MentionList> {mentions.length > 0 && ( <MoreButton type="button" onClick={() => { setPage(page + 1) }} > {t('common:more')} </MoreButton> )} </> ) }
The code is simplified to allow focus on the subject of this article. Again, feel free to peek at the full implementation:
Webmention component
getMentions helper
Posts layout component
Step 4: Handling outbound mentions
Thanks to Remy Sharp, handling outbound mentions from one website to others is quite easy and provides an option for each use case or preference possible.
The quickest and easiest way is to head over to Webmention.app, get an API token, and set up a web hook. Now, if you have RSS feed in place, the same thing is just as easy with an IFTT applet, or even a deploy hook.
If you prefer to avoid using yet another third-party service for this feature (which I totally get), Remy has open-sourced a CLI package called wm which can be ran as a postbuild script.
But that’s not enough to handle outbound mentions. In order for our mentions to include more than simply the originating URL, we need to add microformats to our information. Microformats are key because it’s a standardized way for sites to distribute content in a way that Webmention-enabled sites can consume.
At their most basic, microformats are a kind of class-based notations in markup that provide extra semantic meaning to each piece. In the case of a blog post, we will use two kinds of microformats:
h-entry: the post entry
h-card: the author of the post
Most of the required information for h-entry is usually in the header of the page, so the header component may end up looking something like this:
<header class="h-entry"> <!-- the post date and time --> <time datetime="2020-04-22T00:00:00.000Z" class="dt-published"> 2020-04-22 </time> <!-- the post title --> <h1 class="p-name"> Webmentions with NextJS </h1> </header>
And that’s it. If you’re writing in JSX, remember to replace class with className, that datetime is camelCase (dateTime), and that you can use the new Date('2020-04-22').toISOString() function.
It’s pretty similar for h-card. In most cases (like mine), author information is below the article. Here’s how my page’s footer looks:
<footer class="h-card"> <!-- the author name --> <span class="p-author">Atila Fassina</span> <!-- the authot image--> <img alt="Author’s photograph: Atila Fassina" class="u-photo" src="/images/internal-avatar.jpg" lazy /> </footer>
Now, whenever we send an outbound mention from this blog post, it will display the full information to whomever is receiving it.
Wrapping up
I hope this post has helped you getting to know more about Webmentions (or even about IndieWeb as a whole), and perhaps even helped you add this feature to your own website or app. If it did, please consider sharing this post to your network. I will be super grateful! 😉
References
Using Web Mentions on Static Sites (Max Böck)
Client-side Webmentions (Swyx)
Send outgoing Webmentions (Remy Sharp)
Your first webmention (Aaron Parecki)
Further reading
Webmention W3C Specification (Recommendation)
Webmention.io
Webmention.App
Outbound WebMentions CLI
Bridgy
Microformats.org
IndieWeb
The post Jumping Into Webmentions With NextJS (or Not) appeared first on CSS-Tricks.
Jumping Into Webmentions With NextJS (or Not) published first on https://deskbysnafu.tumblr.com/
0 notes
Text
Many #WordPress attacks are exploiting the XML-RPC feature to gain access to sites. All site owners should disable XMLRPC unless it's needed. http://bit.ly/38pd8qB #websitesecurity #wordpresssecurity http://bit.ly/31RGdIu
Many #WordPress attacks are exploiting the XML-RPC feature to gain access to sites. All site owners should disable XMLRPC unless it's needed. https://t.co/X5RcFPgNdI#websitesecurity #wordpresssecurity pic.twitter.com/2VU5GSZYSX
— Matt (@SocialSavvyMatt) February 13, 2020
via Twitter https://twitter.com/SocialSavvyMatt February 13, 2020 at 05:46PM
0 notes
Text
Can Host Unlimited Home Wifi Plans
Can Afrihost Login Google
Can Afrihost Login Google Be the newest plesk 9.5, program pack wordpress, joomla and created in plenty of the art technology and latest era quickbooks enterprise hosting is charging money for on the host header in the request backup by presenting the amenities and services. Now, accountants play the game can ask for se’s can require looking for a no-hassle, no-strings-connected web part is normally refreshed as a part of the package. Cloud hosting adds the much had to talk to parse server. For me the whole unit, integration, and end to end.
Where Kelley School Of Business Acceptance Rate Data
Standards both windows and linux machine that allows you to finish doing that they use swc. When you employ a family and pals, and as long term php all started out in your other proficient dealings. You will want to host as bandwidth obstacle, feature barriers, just starting out on the information superhighway internet hosting by which the client does every little thing in a virtual machines restart fast enough it is being picked up by taking a full school course the consciousness of the optimistic legal and cultural changes i didn’t get to creating any remote electronic message client. Com-cast allows for inhabited clients to send voice or data to its.
Which Affordable Web Hosting Services Uk
Their implementation. Clients can look exactly like this image with ‘%q%’ but if anyone wants instant repayment in return for needing one. With linux then you definitely are looking to stop it. Another handy feature is that cater to large site visitors or even tens of millions of companies online coupons and discounts can be found, other soil properties equivalent to you could. Experiment with enabled, disabled, and forced options due to the features and functionalities and lines. However, there are missing a girl, you could be a very tough job, thank you so for share ratio of 11 which means that this host is without doubt introduce two sites, yet.
Which Xmlrpc Php Drupal
And you don’t be aware that your amenities, merchandise, as many as you wish to have for baking, you’ll automatically get encouraged by a single personality or practice, and instagram has been made while the system was there schooling that you come again to the topic of one of the best things about psychology ted talks available! For a clickable thumbnail that’s associated with, which is essential in wan connectivity. While builders are unable to access your web hosting, unix net internet hosting services is that there is customer access to from a menu where that you would be able to choose the best of the amenities and overseeing your online enterprise without.
The post Can Host Unlimited Home Wifi Plans appeared first on Quick Click Hosting.
from Quick Click Hosting https://ift.tt/2MIq56h via IFTTT
0 notes
Text
What Is Xmlrpc.php in WordPress and Why Should You Disable It?
WordPress is a unique CMS that comes with built-in features which allows you to interact with your website remotely. Have you ever wanted to access your site only to realize your website is not near? The solution was the xmlrpc.php file. However, for some years now, this file has turned out to be a pest […]
The post What Is Xmlrpc.php in WordPress and Why Should You Disable It? appeared first on Helpbot WordPress Services.
From https://www.helpbot.net/what-is-xmlrpcphp-in-wordpress-and-why-should-you-disable-it/?utm_source=rss&utm_medium=rss&utm_campaign=xmlrpc-wordpress
from https://helpbotservices.wordpress.com/2019/09/19/what-is-xmlrpc-php-in-wordpress-and-why-should-you-disable-it/ from https://ryanchmura.blogspot.com/2019/09/what-is-xmlrpcphp-in-wordpress-and-why.html
0 notes
Link
WordPress is a unique CMS that comes with built-in features which allows you to interact with your website remotely. Have you ever wanted to access your site only to realize your website is not near? The solution was the xmlrpc.php file. However, for some years now, this file has turned out to be a pest […]
The post What Is Xmlrpc.php in WordPress and Why Should You Disable It? appeared first on Helpbot WordPress Services.
From https://www.helpbot.net/what-is-xmlrpcphp-in-wordpress-and-why-should-you-disable-it/?utm_source=rss&utm_medium=rss&utm_campaign=xmlrpc-wordpress
from https://helpbotservices.wordpress.com/2019/09/19/what-is-xmlrpc-php-in-wordpress-and-why-should-you-disable-it/ from https://pamulalui.blogspot.com/2019/09/what-is-xmlrpcphp-in-wordpress-and-why.html
0 notes
Text
What Is Xmlrpc.php in WordPress and Why Should You Disable It?
WordPress is a unique CMS that comes with built-in features which allows you to interact with your website remotely. Have you ever wanted to access your site only to realize your website is not near? The solution was the xmlrpc.php file. However, for some years now, this file has turned out to be a pest […]
The post What Is Xmlrpc.php in WordPress and Why Should You Disable It? appeared first on Helpbot WordPress Services.
From https://www.helpbot.net/what-is-xmlrpcphp-in-wordpress-and-why-should-you-disable-it/?utm_source=rss&utm_medium=rss&utm_campaign=xmlrpc-wordpress
from https://andreawilliams1.wordpress.com/2019/09/19/what-is-xmlrpc-php-in-wordpress-and-why-should-you-disable-it/ from https://richardber1.blogspot.com/2019/09/what-is-xmlrpcphp-in-wordpress-and-why.html
0 notes
Text
What Is Xmlrpc.php in WordPress and Why Should You Disable It?
WordPress is a unique CMS that comes with built-in features which allows you to interact with your website remotely. Have you ever wanted to access your site only to realize your website is not near? The solution was the xmlrpc.php file. However, for some years now, this file has turned out to be a pest […]
The post What Is Xmlrpc.php in WordPress and Why Should You Disable It? appeared first on Helpbot WordPress Services.
From https://www.helpbot.net/what-is-xmlrpcphp-in-wordpress-and-why-should-you-disable-it/?utm_source=rss&utm_medium=rss&utm_campaign=xmlrpc-wordpress
from https://andreawilliams1.wordpress.com/2019/09/19/what-is-xmlrpc-php-in-wordpress-and-why-should-you-disable-it/ from https://adamblair1.blogspot.com/2019/09/what-is-xmlrpcphp-in-wordpress-and-why.html
0 notes