In my App I use an API to handle likes for blog posts. The urls are structured like
path('post/<int:pk>/<slug:slug>/', views.DetailPostView, name='post-detail'),
path('post/<int:pk>/like', PostLikeToggle.as_view(), name='like-toggle'),
path('api/post/<int:pk>/like', PostLikeAPIToggle.as_view(), name='like-api-toggle'),
The issue is google search console is giving me errors because it is trying to index the likes url and not the true url.
How would I prevent the likes URL's from being index by google as I cannot find a way to pass variables in robots.txt or is there a different way to prevent these pages from being indexed.
Update:
Based on the suggested post I'm just a bit confused on how to implement this. Is it just as simple as
Disallow: /*/like
Would this block a url such as
/post/999/test/unsportsmanlike/foo
Updated:
I discovered the google robots.txt Tester and was able to determine that the above query works