I'm attempting to query a URL for my Strapi CMS to find a blog post by it's title, rather than ID, so I can link to it in my web app.
However, I can't figure out how to do it, and the Strapi documentation (from what I've found) only tells how to find by ID.
As an example, the following URL successfully finds all of my blog posts:
https://localhost:1337/blog-posts
The following URL successfully finds the blog post with an ID of '1':
https://localhost:1337/blog-posts/1
Attempting to then find the blog post with a title of "test title" using the following queries doesn't work:
https://localhost:1337/blog-posts/test%20title
https://localhost:1337/blog-posts/title/test%20title
https://localhost:1337/blog-posts/test_title
https://localhost:1337/blog-posts/title/test_title
I figured it would be either 1 or three on those above examples, but no luck.
As an FYI - there is an underscore in the above URLs without %20.
Any tips / pointers would be appreciated!
Strapi doc is fantastic and you can find everything:
You can fetch a single entry by ID (https://strapi.io/documentation/v3.x/content-api/api-endpoints.html#get-an-entry) and you are doing it correctly.
You can also fetch entries (https://strapi.io/documentation/v3.x/content-api/api-endpoints.html#get-entries) passing also filters in order to restrict the amount of entries you will receive.
Filters are well explained here: https://strapi.io/documentation/v3.x/content-api/parameters.html#filters.
In your case, you should call https://localhost:1337/blog-posts?title=test%20title in order to fetch the blog posts with the given title.
Related
I'm not very used to working with Wix and I realized that it has a certain limit regarding the Blog layout. I would like to add the author of each post next to the post, but it would be too much work to do post by post.
So I created an HTML box to get the image and name of the author of the post. But I know I'm not doing it right. See:
Looking in the documentation the most I found was the function getPost() which returns various information from the post page, but 'author' or 'writer' is not among them.
My question is: is there any way to get the author data to display it in this box? Or, is there a simpler way to get to this desired layout?
Author information doesn't necessarily need to be inside an HTML box, if there's another way to do that, that's fine too!!
As seen on https://www.wix.com/velo/example/custom-post-page
You can get the ID of the post - which you already demonstrated you know how to do via getPost() then use that ID to retrieve the extra post data - which includes the currentPost.author entity that you are looking for. You can also see on the same page how this, and other data from that extra post data, can be brought into the page:
function assignPostDataToUIElements() {
$w("#authorName").text = `Written by: ${currentPost.author}`
}
User #Arnon De Paula definitely pointed us in the right direction with their link and should receive the bounty if this ends up being the answer you were looking for.
I'm looking for the correct API for the events that show up in a regular Google Search, the ones that are structured (with name, datetime, location)
Any help or guidance is appreciated
I have tried the Custom Search with no luck, and also the Calendar API (which seems to require a calendar ID, more so for personal calendars or targeted public ones)
We've actually just made an API to scrape the Google event results. You can query it directly like this:
https://serpapi.com/search.json?engine=google_events&q=Events+in+Austin
Or if you are using Ruby, you can do something like this:
require 'google_search_results'
params = {
engine: "google_events",
q: "Events in Austin",
}
client = GoogleSearchResults.new(params)
events_results = client.get_hash[:events_results]
Some documentation: https://serpapi.com/google-events-api
I had a quick look - while I didn't find a fully programatic API yet, here are two things that can get you started on more:
How to search the events page directly: use the following URL schema: https://www.google.com/search?q=cool+conferences&oq=cool+conferences&ibp=htl;events&rciv=evn - replacing "cool+conferences" with any string you like - this can let you create dynamic URLs for event searches.
How to access event metadata for a given page - google is pushing a standard to structure data on webpages to support "smart" searches such as for events. They are using a data structure called JSON-ld. More details. If you want to read such metadata from a webpage, here is one scraper I have found that does that - extruct (though I didn't get a change to test it yet).
Hope this helps :)
My pagination url work at:
checkout.gr/home/index/4
and my webmaster tool see duplicate content for meta description & keywords for page
checkout.gr/home/index/4
checkout.gr/home/index/
and all pagination list…
And final i make slug article for friendly seo url but now my article work with 2 url example:
first url without slug
checkout.gr/magazine/index/3
ulr with slug
checkout.gr/magazine/index/3/to-penintaraki-byronas
and make again duplicate content again…
How can i fix it?
This is normal, you can counteract this behaviour in a number of different ways. Like a 301 redirect, sitemaps,...
you can find some more detailed information on this page (watch out, some solutions mentioned here are only relevant to google)
https://support.google.com/webmasters/answer/139066?hl=en
The documentation says how I can limit searches to a country by using componentRestrictions. However, the documentation apparently only relates
to JavaScript.
I'm doing a regular request from a PHP application, and need to limit a place
search to a country. However, I can't see how I can limit search results to a country using a regular GET request.
I believe you can just add components=country:XX to your request URL :)
I what to record all my website searches with google analytics but the problem is my search links look like this
**www.mywebsite.com/search/category/your+query+here**
From what i found out i must give GA the query parameter (mywebsite.com/search.php?q=your+query+here) but i have none (and don't want any).
Is there a way to rewrite the URL with a google analytics filter? If yes how.
Yes, you can create a custom filter that rewrites URL /search/<category>/<query> to ?q=<query>&c=<category>.
Go to Analytics Settings › Filter Manager, and click Add Filter. Choose Custom Filter in the Filter Type drop-down list, select Search and Replace radio button, and then set two Request URI fields with the corresponding values. For further details, see ’How do I create a filter?’ page in Google Analytics Help Center.
Keep in mind! Since past visitor data cannot be reprocessed, always keep a ’raw’ profile that you do not apply filters against. For further details, see chapter ’Best Practices for Filters & Profiles’ in presentation ’Filters in Google Analytics’.
Site Search is processed BEFORE Filters are applied.
I went through a week of testing to realize this. Yes, the Filter logic is correct, but as of Nov 1, 2009 this will not work with Site Search.
We accomplished this by appeding the ?search= parameter to the page URI in the GA script. Then we strip search params in the Profile Settings and we get the pure URI's in the content section as well as the Searches tracked in Site Search.
I know this is old, but to expand on the prev accepted answer, use a 'virtual url' in the _trackPageview call, so for www.mywebsite.com/search/category/your+query+here have
gat._trackPageview( "/search/content/your+query+here?query=your+query+here&cat=category" )
This means that URLs won't be changed, so everything else works (as noted in the previous answer) - if you really want to you could remove the search params, but unless you're running into a URL limit I'd probably prefer to keep them present so they can be seen in the content reports.