Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Deep links in SvelteKit SPA embedded in a django CMS website

$
0
0

we have the following situation: Two Django based projects (not my plan to have them separated, but for now it is like that) on the same VM on a self administered system: One project has the data, and in the other project we have django CMS and want to retrieve the data via GraphQL API and display them with an overview list with a search form and a detail view of single entries. One example that we have already deployed is this member list of our Austrian association: https://passivhaus-austria.org/static/austria/members/ (for now without search form and not yet integrated into a CMS template, but just served in the static file directory). We have other similar cases. We serve the files as an SPA with Apache. The documentation says that you should rather not use SPAs, but set up a node server which means using another (sub) domain afaik. For another project we might do that, but in this and other use cases the point is a good integration in the CMS.

So far it works well, and with using a store going back to the list view is very fast, but we have one problem: Detail views of entries like https://passivhaus-austria.org/static/austria/members/energieinstitut-vorarlberg can’t be called directly, because it’s an SPA and Apache can’t find the file static/austria/members/energieinstitut-vorarlberg as it doesn’t exist. And that’s the reason why in the docs there’s the recommendation to add a .htaccess config.

Unfortunately it’s not explained, but I figured it out and adopted it for using in a sub directory austria in httpd.conf (200.html has broken links, so I use index.html):

<Directory "/srv/http/austria"><IfModule mod_rewrite.c>        RewriteEngine On        RewriteBase /austria        RewriteRule ^index\.html$ - [L]        RewriteCond %{REQUEST_FILENAME} !-f        RewriteCond %{REQUEST_FILENAME} !-d        RewriteRule . index.html [L]</IfModule></Directory>

So when I now go to http://localhost/austria/energieinstitut-vorarlberg on my developing machine, I get to the overview page, but the information that I want to go to the detail page energieinstitut-vorarlberg is lost. Is there anything that I can do about it? Deep links seem to be very important for my colleagues and members/customers, so just telling them: „Go the the overview and search!“ isn’t an option. I was even asked for links with GET search parameters in another case that I made with htmx.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>