Need help with GraphQL and Gatsby. Task: separate requests and page generation based on mdx, depending on where the file is located.
Simply put: I have a blog and news on the site. The content for the blog is in one folder, and for the news in the next one. All in mdx format.
Difference: the news has a title, the blog has a header.
Lists for files on different pages, as well as the posts and news themselves, are generated according to their own templates.
Hooks are created to get the data in the appropriate folder.
Problem:
only 1 hook works, which overwrites the second hook
post and news pages are generated from all files
Example site: https://github.com/Tecnika/test-site
Sample:
use different types of files.
--- The idea is good, but not suitable for the original project, maybe there are not enough file types
use your type
--- The type was created, but it was not possible to bind it to files and all requests for it were empty (the NewsPages type was created, the search for AllNewsPages returned an empty array)
sorting, filters
--- limit only display list, not page generation
If any of this works in your opinion, then please show me how to do it right.
Need to:
-Generate blog and news lists independently of each other
-Generate pages with posts and news based on their templates
(It is possible to increase the generated pages, for example, a catalog of cats, with pages of cats)
Related
Help me please.
i am working with next js, i need to make this structure in url sitename/catalog/category/group/product
category, group, product pages are created dynamically, after that I need to generate static pages with ready-filled html markup in the out folder via the 'next export' command. I want to get all category, group, product pages to make a completely static site. In the documentation, I did not find information about a large nesting. Please tell me how to do it. Here is my current structure and what next js generates for me
Is it possible to do this?
my file structure
pages
catalog
index.tsx
[category]
index.tsx
[group]
index.tsx
You need to create dynamic URL using [slug] for all dynamic variable in your URL component.
Check the documentation: https://nextjs.org/docs/routing/dynamic-routes
Once you use dynamic URL, you need to serve getStaticProps (for data as props) and getStaticPaths (for diff routes) method on page to serve the data.
Note: above method are only executed on build time, in case of next export also.
I am trying to generate/export the html/css from a Vue Application to a static index.html and the css assets without the script I wrote within the vue app which makes calls to the internal servers.
Use case:
An employee creates a digital Information site about a car of the company.
Here he needs to enter vehiclenumber etc, it then makes a GraphQL query with these parameters to our internal server.
Once the information loaded and is filled in on the site, an option should be given to "Save" (Export) the html/css with only the necessary js for vue components itself to work (e.g. Element vue gallery)
The Employee creates the page using localhost:8080?carnumber=xxx&info=xxx
The Server queries itself should not be included as they will be unreachable from outside the intranet.
So I want the static html to not care about the route and parameters and display the HTML as seen on localhost:8080?carnumber=xxx&info=xxx
I have looked for "static site generators" etc but I have not come across a result I am looking for as the page itself isn't static only the export should be. I also came across Nuxt.js but not exactly how I want it to be, the best would be to have it call like a NuxtGenerateStaticPage(this) function (in my dreams)
Please let me know if anything is unclear.
I appreciate any input/idea :)
Is it possible to create a WordPress page with multiple URLs?
I want one URL per section, all without having duplicate content in SEO.
We don't want to use anchors because they don't have individual rankings like URLs.
There are a lot of plugins that can easily create URLs in bulk for you. I recommend MPG: Multiple Pages Generator because you can customize the content of each page to avoid duplicate content and it's incredibly easy to manage all of your new pages once they’re created.
You just need to have all your products and their variable data in a CSV file and a template page. The plugin creates shortcodes for the information from your file and you just need to add those shortcodes to a template page, like:
Visit us at {{mpg_location}}
The best thing is that if you want to edit anything from your CSV or template page, you can do that anytime. Find out more about it here: https://mpg.porthas.com
I am building a application for the first time in node.
My website will include a static list of countries, music genres and so on...
Should I store the data in my database, or should I use a static json file with a list(countries, genre)?
My folder structure looks something like src\lib..scsss..server and so on.
My question ultimately is - Is there a best practice for storing static lists in node - if a josn file is preferred where should this exist in my folder structure?
If your data is not gonna change and static, then you should use file system which will have high R/W operation rate compared to communication with DB Server overhead.
Moreover you can use filecache to cache all your static files. Which will load the files even faster.
The answer is really that "it depends" upon some things you have not specified.
First off, if it is a list of data that does not change while your app is running (or changes very infrequently), then you don't want to load it from some remote source every time you need it. You will want to load it once and then keep that list in memory for subsequent use. This will be a lot more efficient for your server.
As to where to store the list in the first place, you have several choices that depend upon who is going to maintain that list and what level of programming skill they might have.
If the list of countries will not change often and will be maintained by a Javascript developer, then you can either put the list right into a Javascript literal in your code or in a JSON file in your file system. If choosing the latter option as a JSON file, it can be in the same directory as your Javascript source files and just loaded directly with require() upon startup.
If the list of countries will be maintained by someone who is not a Javascript developer, but can be trusted to follow JSON syntax rules, then you can put the list in a JSON file. Whether you put this file in the same directory as your JS files or in a separate data directory really depends more upon how your application is deployed, who has permission to do what, etc...
If the list of countries will be maintained by someone who has no idea about programming or syntax rules and should be modifiable completely independently from your code, then you may want to either put it in the database and build some sort of admin interface for modifying it or put it in a plain text file (one country per line) and then parse that file upon app startup.
My website sells stuff and I would like to customize the page title and meta description in certain pages when certain items are viewed. I would want these custom titles and descripts to be listed when shared on other websites. E.g.: Twitter, FB, etc...
Basically I want to customize the title and description based on the query string values. How is this possible? I've looked a js based plugin or similar on github as well but had no luck.
The issue with JavaScript rendered pages is that there's no guarantee a scraper will pick up the meta tags. The headers are read before scripts are run - meaning to lower overhead they likely won't even bother executing it. Better if you write a script that writes customised meta tags to the HTML file.