Copy link to clipboard
Copied
After opening a blog post in a certain category, I would like to be able to set the url to reflect the fact it's under that particular category...
At the moment the url looks like http://streeten-new.streeten.co.uk/blogname/blogpostname
Is it possible to somehow change this to display as http://streeten-new.streeten.co.uk/blogname/categoryname/blogpostname ?
I couldn't see an obvious way, simply trying to set the blog post url to categoryname/blogpostname instead of just blogpostname didn't work because it didn't like the / symbol in the name.
Copy link to clipboard
Copied
bump?
Copy link to clipboard
Copied
Yeah bump to this as well.
Copy link to clipboard
Copied
Hi Luke,
If you go to a blog URL and click on category, it should display the URL as siteURL/blogURL/category/categoryname.
You can test it by going to blog on my test site: asdyuf and click on a category on right side. Then check the URL.
Regards,
Gaurav Aggarwal
Copy link to clipboard
Copied
Yeah, It does do this So I do not understand the bumping (which is against forum rules by the way guys).
What are we missing?
Copy link to clipboard
Copied
Cheers Liam - I was unaware of this rule so thanks for letting me know. Oops!
Thanks for the suggestion Gaurav and that is useful - I was unaware of the Category + URL feature.
I can't speak for the other Luke but what I wanted to do was make the blog sit under another page. So on my site I want a page called "Resources" which give a bunch of preliminary info including links to a number of blogs. I really want those blogs to exist as sub-pages of the Resources page, e.g. www.mysite.com/resources/blog1.
I thought that maybe I could do this using a similar technique to web apps, where you set up a folder and create an index.html and then can set the web app URL with the same name as the folder. But the URL field for blogs won't allow the "/" character, so there this no way to make the blog exist anywhere other than as a sub-page of the root, i.e. www.mysite.com/blog1
Does that make sense?
Copy link to clipboard
Copied
You would make a web app called resources for that kind of thing Luke.
And then make a folder called the same as the webapp folder and put an index.html page in there. (Yes you can do this)
then you have a landing page under /resources and then all the items that you are looking to do will be /resources/myitemthing
Copy link to clipboard
Copied
Luke,
Yes it is possible, I did this for a customer using liquid (module_data) and AJAX.
Here is the liquid, it does 32 posts to a page and has a "load more" button which then loads the next page of 32 blog entries. This blog had separate blog categories you could view or an "all posts". It is ordered via newest first. You will need to change <CATID> and <BLOG ID> to your ID's. Just put this on another page and use jquery to get the data and then inject it into the page.
{% if globals.get.page %}
{% assign page = globals.get.page | convert: "number" %}
{% else %}
{% assign page = 1 %}
{% endif %}
{% assign cat = {{globals.get.cat | downcase}} %}
{% assign catid = -1 %}
{% case cat %}
{% when '<CAT NAME>' %}
{% assign catid = <CATID> %}
{% when '<CAT NAME>' %}
{% assign catid = <CATID> %}
{% endcase %}
{% assign page = page|minus:1 %}
{% assign skip = page|times:32 %}
{% if catid == -1 %}
{module_data resource="blogposts" version="v3" fields="postTitle,postBody,postUrl" skip="{{ skip }}" limit="32" where="\{'blog.id':'<BLOG ID>','releaseDate':\{'$lt':'{{globals.site.dateNow}}'\}\}" order="-releaseDate" collection="myData"}
{% else %}
{module_data resource="blogposts" version="v3" fields="postTitle,postBody,postUrl" skip="{{ skip }}" limit="32" where="\{'categories.categoryId':'{{ catid }}', 'blog.id':'<BLOG ID>','releaseDate':\{'$lt':'{{globals.site.dateNow}}'\}\}" order="-releaseDate" collection="myData"}
{% endif %}
{{myData|json}}