Can you remove /pagetwo from a multipage website? - html

If you a have a multipage website for example www.examplesite.com
and you have a few pages : www.examplesite.com/pagetwo etc...
is it possible to remove the /pagetwo from the searchbar? or present this in a cooler way. I suppose www.examplesite.com/2 is more minimal, but is there any way to completely remove this?
Many Thanks
Harry

You can manipulate the state of the URL via JS like this:
history.pushState("object or string", "Title", "/");
Read more here: http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/
In the variation above, the last bit ("/") says push the URL back to site root.
But I'd recommend asking why you want to do this and if it's the best solution. You could easily create bad user experiences and prevent people from bookmarking or sharing the content they intend to.

Related

Removing HTML Comments from Wordpress Blocks in JSON

I'm trying to make a custom API in Wordpress via register_rest_route() and some CPTs (with CPT-UI Plugin).
All ok but I'm not managing to clean the html comments [created by gutenberg's blocks] from the body text (the_content).
The best solution so far was to put sanitize_text_field( get_the_content() ).
A second solution was to put Show in Rest = false in the CPT Plugin options, which sounds a step back but it removes them.
I also tried wp_strip_all_tags() but some characters were decoded.
But I'm sure there is a better, "official", solid and future proof solution for this..?
Thanks!

how do i pagination works in HTML

i created a site, And added pages to my site, since page size exceeds i need to create pagination in html i have created this method
123
in this way i created
Problem is when i add new page i need to replace all code again like this
1234
ever time when i add new page i need to replace all code is ther a way to do this without PHP
Can sombody help me any idea to do this in html
Do not re-invent the wheel. Use datatables, they provide sorting, pagination (client side and server side), export and a number of additional features.
http://datatables.net/
Include the files and just add this.
$(document).ready(function() {
$('#example').dataTable();
} );
This is a very basic and good example, you should go for it.
http://datatables.net/examples/data_sources/dom.html
This cannot be done purely in HTML. You must use something like PHP, or you could use Javascript.
You can make just one HTML file called "Pagination.html" include all your links there and then include that Pagination on every page using one of the following methods.
You can use Javascript: javascript
Or you can use html5: html5
Or there are also, others solutions to solve your problem like this: other
You better use some Javascript oriented solution, html5 support for including files still very poor.
unfortunately, this won't be possible without using some other technology that is not HTML. You can dynamically generate pages using javascript (JS), PHP or other technology, but not just raw HTML.
You can name your pages something like:
page_1.html
page_2.html
and then whichever editor you are using probably has a search & replace function, so you could use that to speed up things. I hope this helps.

rel="tag"on conditional filters against keyword stuffing?

i use filters/tags on my webapp to sort articles dynamically. now these filteres do not really match microformat.org's idea of rel="tag" (no url, not a tag, i don't know), but i don't see any other way to avoid google seeing it as keyword stuffing.
is there a better way so highlight these "tags" or would you
encourage me to use rel="tag".
see it yourself: http://www.rewow.de/eiweisspulver/
thank you very much!
Clicking one of the "tags" changes the content of the page using JavaScript.
Your JavaScript should be unobtrusive and progressive.
They should be links with URLs and if the JavaScript fails, then you can generate the same content on the server. (You can use pushState to make the address bar match the target page when you successfully transform the current one into it with JS).
That way they match microformat.org's idea of rel="tag", and your site is more reliable and search engine friendly.

Retrieve all hashes in a page for URL use

I am trying to copy a link from this site (stack overflow), but I like the link to include a hash so when someone clicks on the link they go directly to the answer I would like them to see. How can I find the hashes in a page?
Example:
http://www.blahblah.com/index.php#label
How can I know there is a #label, and how to find it?
The value of the hash is simply the ID attribute of any element in the page.
You can see them in the source or the DOM inspector.
Are you looking for something like this?
var hash = window.location.hash;
There might not be a simple answer for your here. In a pure HTML context (i.e. excluding javascript functionality). The has would reference an anchor on the page like this:
<a name="label"></a>
So you could just look for named anchors.
Now, if you are talking about javascript functionality it gets much more complex. Via javascript you can use a hash tag like that and make it do any number of things (like show a hidden element with id="label", download some content asynchronously based on that hash, etc. So there might not be an easy way to determine allowable values.

URL Masking in .Net / HTML

I have a website in which I have many categories, many sub-categories within each one and many products within each of those. Since the URLs are very user-unfriendly (they contain a GUID!!!), I would like to use a method which I think is called URL Masking. For example instead of going to catalogue.aspx?ItemID=12343435323434243534, they would go to notpads.htm. This would display the same as going to catalogue.aspx?ItemID=12343435323434243534 would display, somehow.
I know I could do this by creating a file for each category / sub-category (individual products cannot be accessed individually as it is a wholesale site - customers cannot purchase directly from the site). This would be a lot of work as the server would have to update each relevant file whenever a category / sub-category / product visibility changes, or a description changes, a name changes... you get the idea...
I have tried using server-side includes but that doesn't like it when a .aspx file is specified in an html file.
I have also tried using an iframe set to 100% width / height and absolutely positioned left 0 and top 0. This works quite well, but I know there are reasons you should not use this method such as some search engines not coping with it well. I also notice that the title of the "parent" page (notepads.htm) is not the title set in the iframe (logically this is correct - but another issue I need to solve if I go ahead and use this method).
Can anyone suggest another way I could do this, or tell me whether I am going along the right lines by using iframes? Thanks.
Regards,
Richard
PS If this is the wrong name for what I am trying to do then please let me know what it actually is so I can rename / retag it.
Look into URL Rewrites. You can create a regular expression and map it to your true url. For example
http://mysite.com?product=banana
could map to
http://mysite.com?guid=lakjdsflkajkfj3lj3l4923892&asfd=9234983920894893
I believe you mean URL Rewriting.
IIS 7+ has a rewrite module built in that you can use for this kind of thing.
URL Rewriters solve the problem you are describing - When someone requests page A, display page B - in a general way.
But yours is not a general requirement. You seem to have a finite uuid-to-shortname mapping requirement. This is the kind of thing you could or should set up in your app, yourself, rather than inserting a new piece of machinery into your system.
Within a default .aspx page, You'd simply do a lookup on the shortname from the url in a persistent table stored somewhere, and then call Server.Transfer() to the uuid-named page associated to that shortname.
It should be easy to prototype this.