I have a link in my page.ss that needs rewrite_hash_links set to false.
<span class="glyphicon glyphicon-menu-hamburger"></span>
I've found the documentation but have no idea how to apply it to just the one link. https://docs.silverstripe.org/en/3.1/developer_guides/templates/how_tos/disable_anchor_links/
So, do you want the #menu link to go to <root of site>/#menu?
This is what simply disabling the rewrite would do, assuming you still include the base tag in your source.
In any case the rewrite_hash_links functionality only applies to unqualified hash links. In other words if you put an absolute URL in the link, it shouldn't be rewritten.
Example
...
or:
...
Related
As you can check in the following link
https://benetialingerie.gr/product-category/%ce%ac%ce%bd%ce%b4%cf%81%ce%b5%cf%82/
there are some color attributes.
In the following link, you can check a report via webaim with some accessibility errors.
https://wave.webaim.org/report#/https://benetialingerie.gr/product-category/men/?lang=en
Just because all colors are buttons too, I want to insert somewhere an alt txt or something which, if I understand right, points out that it is a link.
The error I got is:
Empty link
A link contains no text.
Due to my limited developing skills, I don't know where exactly I must edit the code. I found something relevant, a plugin called "Variation Swatches for WooCommerce".
Can anyone help me out fixing this?
Just add an aria-label to your link. It will not only make the WebAIM/WAVE report happy, it will also allow a screen reader to hear the color name when they navigate to the link.
<a aria-label="red" href="https://benetialingerie.gr/product-category/%ce%ac%ce%bd%ce%b4%cf%81%ce%b5%cf%82/?filter_color=%ce%ba%cf%8c%ce%ba%ce%ba%ce%b9%ce%bd%ce%bf" rel="nofollow" class="rtwpvs-term-span rtwpvs-term-span-color" style="background-color:#db100a;" role="link"></a>
Note that you have role="link" on the <a>. The default role of an <a> element is already a link so the role attribute is not needed.
I recently was using create-react-app and noticed that the <a> tag in App.js was using the noopener noreferrer attributes. I also noticed that scattered throughout our code-base, are <a> tags which do not use the above attributes.
I wanted to, using grunt-htmllint, add a rule that would enforce the adding of these attributes but am having trouble with the value that I should add to what I think would be "tag-req-attr".
The documentation for the rule is listed here, but the usage for me is confusing. How can I set the specified <a> tag to include said rules?
I am looking for a way to enforce that the rel attribute contains both noopener and noreferrere.g.:
My Link
Thanks
According to, https://developers.google.com/web/tools/lighthouse/audits/noopener, it looks like noreferrer handles both cases: rel="noreferrer" attribute has the same effect, but also prevents the Referer header from being sent to the new page.
In that case, simply using the link-req-noopener rule should be sufficient.
I've been having issues with this but I think is simple.
asp.net core 2.0 Razor Pages
I have a Users/index page and I added a link to take me to the child records under Entries Folder.
Structure is like
Pages
/Users
/Entries
Under /Pages/Users/index.cshtml
<a asp-page="./Edit" asp-route-id="#item.Id">Edit</a> |
<a asp-page="./Details" asp-route-id="#item.Id">Details</a>|
<a asp-page="~/Pages/Entries/" asp-route-id="#item.Id">Enter Child Records</a>
However, on the browser, looks like is not rendering the correct link. It staying under the default page.
I tried asp-page="../Entries/" and other combinations with no luck.
Can't believe this but this works.
<a asp-page="../Entries/Index" asp-route-id="#item.Id">test</a>
I think your own answer might add confusions to others. First of all, you're talking about LINKs to another page, not redirect to another page. Razor Pages have a designated function for page redirections.
About the asp-page tag helper, it's interpreted by the code-behind engine (e.g. C# syntax) and so the "~" doesn't work. Basically, asp-page is expecting a name. In your own examples:
<a asp-page="./Edit" asp-route-id="#item.Id">Edit</a> |
<a asp-page="./Details" asp-route-id="#item.Id">Details</a>|
will work, but they should be shortened as:
<a asp-page="Edit" ...>Edit</a> |
<a asp-page="Details" ...>Details</a>|
because they are in the same folder as your /Users/Index page. As you know the "./" part just means going up one level to your parent folder and so it's redundant. You don't want to instruct your engine to go up one level and then come down again to the same folder immediately.
When you need to switch to another containing folder, going up two levels and specify the new folder name. So, the "../NewFolder" works.
If it is at the web site root level, you can use the root syntax directly for faster routing. So both of these work the same if AnotherFolder is under root:
<a asp-page="../AnotherFolder/Index" ...>test</a>
<a asp-page="/AnotherFolder/Index" ...>test</a>
The asp-page tag helper is expecting a real page name at the last part and hence the quoted text must be ended with a page name. You cannot use asp-page="/Entries/" as in HTML URLs and expect the engine to default to Index page for you.
Lastly, to cover redirecting pages, code-behind has a function called return RedirectToPage(string pageName, ...), and its first parameter uses the same page routing syntax as the asp-page tag helper described above.
There is also a Redirect() function that works with pages outside your Razor Pages system, which can take any URLs as your browser or HTML code do. That's another story.
I'm trying to append DateTime.Now.Ticks to my link to stop it from caching as I'll be replacing it often. The problem I'm having when I do the code below is that it's adding a Content path in the url.
The original link was:
<a target="_blank" href="~/Documents/Data/Acct/MyDocument.pdf">Document</a>
This obviously caches the file on the browser so when I overwrite MyDocument.pdf the users don't see that unless they Ctrl-F5. So I changed it to the following:
<a target="_blank" href=#string.Format("{0}?t={1}", "~/Documents/Data/Acct/MyDocument.pdf", DateTime.Now.Ticks)>Document</a>
This produces a link that looks like: Content/~Documents/Data/Acct/MyDocument.pdf" which obviously doesn't exist because it's adding in Content and keeps the ~. If I remove the ~ I still get Content/Documents/Data/Acct/myDocument.pdf. How do I stop .NET from adding this Content/ to my link?
To add, the page that this link is in, is inside a folder called Views/Content. So I guess that's where it's being called from, but the ~ I assume should go up a level but it's not.
<a target="_blank" href=#string.Format("{0}?t={1}", "../Documents/Data/Acct/MyDocument.pdf", DateTime.Now.Ticks)>Document</a>
If you want to go up a level in your Url use ../ should get rid of the Content
I've added the following code inside a Drupal block, to display an image.
<img alt="Fuzion logo" src="sites/all/themes/zen/zen/logo.png" />test<br />
I've tried several urls. For none of them I can see the image in my front-end website. The block only contains the text "test".
hostingpath/sites/all/themes/zen/zen/logo.png ---> I can see the logo in back-end (editing field, only with this)
sites/all/themes/zen/zen/logo.png
logo.png
thanks
Did you remember to use an appropriate filter that allows img tags?
Although your question was answered, I have found this also can happen when using the pathauto module with the path to your page set as a "subdirectory"; e.g. www.example.com/path/to/page.
As a result, the web server will look for your image at /path/to/page/sites/all/themes/zen/zen/logo.png because the URL is relative.
If this occurs, make sure to provide an absolute URL by including a forward slash at the beginning, i.e. /sites/all/themes/zen/zen/logo.png instead of sites/all/themes/zen/zen/logo.png.
Perhaps this answer will assist someone else with a similar problem.