Customizing Route in Vue - vue.js

I'm using Vue and I currently have a page setup that is in the folder structure:
/pages/tg/_tg_id.vue
The setup is working fine as going to website.com/tg/<user-id> resolves to the user's page based off ID.
I'm now being asked to include a username in the URL, but I still need the id as names change and some user's don't even have a name. As a solution I'd like the new URL structure to be:
website.com/tg/<user-id>/<any string>
So that we can use a link that has the username in it, purely for vanity purposes (putting any string after the last slash should resolve in the exact same way).
I'm unsure of how to set something like this up, currently my nuxt.config.js file has no routing settings. Is there something I can add to settings to get the desired behavior?

If you need only second option with username you can just rename your page to
/pages/tg/_tg_id/_username.vue
and thats it.
If you still need your first url too you can use https://github.com/nuxt-community/router-extras-module and define alias inside your page or by extending routes by hand.

Related

How to get a free Google-provided domain (for example, yourapp.page.link)

I am following an example to add an email link, but after I click on Dynamic Links, it doesn't provide me with a default url, like in the picture (flutterauth.page.link). I get an empty box, no dropdown.
How do I get a Google provided page.link subdomain, like in the picture?
This is what mine looks like:
I figured out. It's very simple. The url is not pre-created, it doesn't show up by default. You have to start typing, and then you can create a url, if the url link is not taken.
Afer this, you will get a message:
myapp.page.link has been verified and approved for use

How to rename thewire's URL in Elgg?

I have an install of ELGG, and I set up thewire. I hate the name thewire so I modified the language file, so it would look like posts.
When I looked at the URL on the posts page, it still said http://localhost/thewire, not http://localhost/posts. How would I make .htaccess change the URL to the desired effect.
I tried mod_rewrite, but I don't know what to do with it.
You need to do two things:
Change the URLs produced for thewire posts (register your own handler):
elgg_register_entity_url_handler('object', 'thewire', 'CUSTOM_HANDLER');
Handle new URL format instead of original one:
You may use 'route' plugin hook or try to use already existing plugin for that: http://community.elgg.org/plugins/854839/1.1/pagehandler-hijack-18x

get subdirectory relative URL from relative URL

We have an MVC4 application,
there is a navigation panel at left side of the screen and this navigation tree is built dynamically along with additional parameters.
so we store the navigation Url in a column in a table (say /Dataset/Financial).
now when application is hosted on a subdirectory(say http://localhost/xyzabcd/) the Url generated dynamically from the table still targets the root(ie., http://localhost/Dataset/Financial).
I got to know that Url.Action() will actually solve the problem.
Now since it has been designed like that, I would like to know if there is any standard way I can get the fully qualified URL for a relative URL(so that we don't have to make any change in the db)? Is there any built-in or existing method for doing this?
If you add the scheme/protocol, it should give you the FQDN that you're looking for.
Example
Url.Action("Action", "Controller", new { routeData = 1}, "http")
Note, that routeData I just put in as a placeholder. You could set that to null if desired. Also, "http" could also be "https"

Yii-User and Yii-eauth integration

I am trying to put together an application using yii-user and yii-eauth extensions but I am coming up short. When I create a new webapp and install eauth I can get it to work fine so I know that I am not doing anything wrong on that end. I think the problem lies with my urls. This is a demo of what it is supposed to be like: http://nodge.ru/yii-eauth/demo/login. When someone clicks on say google it should bring you to the google sign in page but on my application I am getting a 404 error that states "The system is unable to find the requested action "login"." The url for this is user/user/login/service/google_oauth whereas the url should read user/login/service/google_oauth. Upon typing this into the browser manually I am redirected to the right page.
So I took a look into the EAuthWidget.php class to see if I could find out where it was getting that extra "user" from but I could not figure it out. I think it may have something to do with the fact that I have this in the user module which is in the /modules/user directory in my webapp. I also tried to use the URLManager to point to the right address but with no luck.
Does anyone have any similar experiences setting this up? Or any suggestions?
You just need to change the widget initialization code in your view(namely change the action property of the widget), somewhat like this:
<h2>Do you already have an account on one of these sites? Click the logo to log in with it here:</h2>
<?php
$this->widget('ext.eauth.EAuthWidget', array('action' => 'login'));
?>
Just to add, keep in mind that this action depends on which view you are including this widget, if the view is protected/views/site/login.php (which is yii's default site login view) then action should be able to go to the yii-user module's login action, so it'll be : 'action'=>'/user/login' , however if you are including this widget in yii-user's protected/modules/user/views/user/login.php then the action will be 'login' as already mentioned.

How to create MSDN like links in Sandcastle documentation website?

I've generated a website documentation of my project with Sandcastle. This website uses frames so when I click though sites my URL in browser does not change.
I would like to have URL changed in browser when I browse through website documentation generated with Sandcastle. Why? Because I would like to link to concrete subpages of documentation from other parts of my developer environment.
And further more I would like to have this links permanent. So when I generate once again documentation from new version of my project, links will not change so that I will not need to change all links to new.
Is this possible and how to acomplish this?
If you add the code below to the top of SplitScreen.js the browser will "inject" the TOC frame and focus on the content you linked directly to (using the trick Vitaly Shibaev showed).
if (window==top) {
window.location = "/?topic=" + (window.location.pathname.substring(1));
}
This code works it the documentation is placed at the root of your website - if you have it in a sub-folder you need to expand on "/?topic" and remove the sub-folder part from the pathname part.
With this change you can use the "direct links". I also expect people who find you via Google get a better experience (getting the content they searched for AND the TOC bar).
In order to create correct links to specific subpages of documentation you may use similar request: $DOCUMENTATION_ROOT$/Index.aspx?topic=html/$TOPIC_ID$.htm
E.g. http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
instead of http://www.ewoodruff.us/shfbdocs/html/8dcbb69b-7a1a-4049-8e6b-2bf344efbbc9.htm
Vitaliy and mawtex have solved the 'how to link to documentation subpages' part of your question.
The "making links permanent so they do not change when regenerating documentation" part of your questions is solved automatically, since the html file names created are based on a hash of the topic name by default. I.e. If you do not change the part of your code that you are documenting, then it will use the same file name.
You can change the way that html file names are generated, but all given methods are based on the member name or a hash of the topic ID, so links shouldn't break if the code hasn't changed.
See Sandcastle Help File Builder's NamingMethod documentation for more info.