Will HTML5 app.manifest work with MVC style URLS? - asp.net-mvc

Given the following example manifest:
CACHE MANIFEST
# v1 2011-08-14
# This is another comment
index.html
cache.html
http://somedomain.com/abc/xyz/
/style/css
controller/view/1
# Use from network if available
NETWORK:
/api
# Fallback content
FALLBACK:
/ fallback.html
Will "/style/css" and "/controller/view/1" work, or does it require actual file names? I keep reading about putting "files" there, but on other sites I read "URI". I'm assuming URI is correct. So, are full AND relative URIs allowed? Any cross-browser/device issues to be aware of?
BTW 1: Yes, I'm aware that "file names" are just part of a URI, and names don't dictate content (image.png could download a text file, for example, if one wanted to). I only want to confirm that URIs work well in the CACHE MANIFEST section, thanks.
BTW 2: I'm aware that Mozilla states URI for the cache manifest, so as mentioned, I just want to confirm.
https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache

You can use a dynamic manifest file which is actually designed to work with MVC. I've not had chance to use it myself but it looks really good!
http://deanhume.com/home/blogpost/mvc-and-the-html5-application-cache/59

Related

How to translate urls in Gatsby.js with i18next

I try to make my gatsby page multilingual.
I am using gatsby-plugin-react-i18next, i18next and react-i18next like in documentation.
i18n adds language prefix but page url is still the same. How i can translate friendly url?
i have: domain/es/hello-world
but i want: domain/es/hola-mundo
Is there a simple solution to this in GatsbyJS or is it more complicated?
I have found a solution to our problem. I have created a .json file with the original path and the one I want to change. For example: /es/contact/": "/es/contacto.
I create this file manually, and I add a path for each page that I want to change the path. Then, in the gataby-node file, I create the oncreatepage api (there is documentation for this api). In this function, I take the page parameter.
if page.path == to some .json file path, change the path to that of the .json file.
Thks for help. Finally i found perfect answer for my needs. gatsby-plugin-i18n-l10n have all i need for multilingual gatsby website with url translation too. I really recommend this module and I appreciate the work of the creators.
Here is link to github where you can find that plugin:
gatsby-plugin-i18n-l10n

Configure Eleventy not to use directories for output?

Is it possible somehow to do a general configuration for Eleventy so that 'my_file.html' in the input folder ends up just as 'my_file.html' in the _site folder, not '/my_file/index.html'?
I know I can do it on a file by file basis with permalinks. But I'd like it configured for the site as a whole, if possible.
Unfortunately, since this behavior isn't encouraged, there isn't a simple configuration option to disable the directory output.
However, since permalink is part of the data cascade, you can set a global default, and in combination with the filePathStem computed data, you can set the output to be .html files.
To set a permalink using a global data file, add a permalink.js file to your global _data directory.
// _data/permalink.js
module.exports = '/{{ page.filePathStem }}.html'
There is also a config global data option coming soon to v1.0.0. I am not sure if it will handle the {{ page.filePathStep }} preprocessing, but if it does, that could be an option too, especially since it will keep config-related things inside the config file.
Yes, you can control where Eleventy writes things out by specifying a permalink value in the front matter. This is covered here: https://www.11ty.dev/docs/permalinks/#remapping-output-(permalink)
An example would be:
---
permalink: "/my_file.html"
---

What is the proper way to set up resource URLs in a ClojureScript single page application

I am developing a Clojure/ClojureScript SPA based on http-kit, compojure and tiny bits of hiccup on backend and mainly reagent on frontend. Project is done with leiningen, based on hand-wrecked chestnut template.
When I tried to make more complex URLs than just "/" the following setup created a mess for me:
When producing the initial hiccup to serve HTML and adding includes for CSS and JS files I followed the examples and added them as relative urls like
(include-css "css/style.css")
;and
(include-js "js/compiled/out/goog/base.js")
(include-js "js/compiled/myproject.js")
(note absence of slash in the beginning)
In the chestnut template I got default :asset-path option for cljsbuild set to "js/compiled/out"
Of course, when I tried to add a route to the same page with the http://my-domain/something URL in addition to root http://my-domain/ and load it, the thing failed to get any of my assets (trying to fetch them under e.g. /something/js/compiled/myproject.js).
I was able to fix this issue for explicitly included assets by making those urls relative to root (prepending a slash to each of them). It left me with the same problem with the script tag with src="js/compiled/out/cljs_deps.js" injected by cljsbuild, but this one I fixed by making :asset-path relative to root as well.
It all seems to work properly now, but the fact that I had to make some head-scratching and a surprisingly large amount of googling to finally resolve this makes me feel this is not the default approach. Hence the questions:
Did I do the right thing by converting all asset urls to relative-to-root ones? (Keeping in mind that I'm working on an SPA)
If yes, why isn't this a default approach and why I keep seeing relative-to-current location URLs everywhere (including all the examples on the web as well as lein templates)?
Update:
The relevant part of my app's compojure routes looks like this:
(defroutes home-routes
(resources "/")
(GET "/" _
(friend/authenticated
(html-response
(app-page))))
(GET "/something*" _
(friend/authenticated
(html-response
(app-page)))))

Path-relative URIs for resource files VS routes that "look-like" sub-directories

I'm using the URL like web.com/sys/test, which is rewritten in nginx config to web.com?system=sys&id=test via rewrite ^/(\w+)/(\w+)$ /?system=$1&id=$2 break;.
Also, all my resource files have relative path.
Therefore I get error:
Unable to find web.com/sys/css/user.css, however user.css is located in /css/.
Is there a way to solve the problem remaining the relative path for resource files?
Used base tag:
<base href="/">
However, in some cases this method may just add a whole lot of new problems. Look at this link

Changing my URL from "../page.html" to "../page/" with URL rewrites

How can I rewrite my url changing my default prefix .html or .php in / ?
For example look here: http://www.anderssonwise.com/studio/vision/
I've found this tut but nothing happen:
http://www.spencerdrager.com/2010/02/07/hide-php-extension-in-url-using-htaccess/
You have to use URL Rewrites, which is why Krister asked you if you have mod_rewrite enabled. It's not the simplest thing in the world to do but here's a pretty good tutorial:
http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
You create a folder, in this example, /page/ and within that folder create index.html and then you'll be able to access the page like: http://domain.com/page/

Resources